SkiaSharp on AWS Lambda - amazon-web-services

I have a .NET core 3.0 API deployed on AWS Lambda. I am using SkiaSharp dll. I get this error:
System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies. liblibSkiaSharp: cannot open shared object file: No such file or directory.
I have tried nuget packages of Skiasharp, skiasharp.NativeAssests.Linux, Avalonia.Skiasharp.NativeAsstes.Linux and also tried with Skiasharp.NativeAssets.Linux.NoDependencies but I'm still getting that error

You need to add the SkiaSharp.NativeAssets.Linux package to your NuGet dependencies. Found that into on this AWS Form post.

Related

Issue downloading dependency from Amazon S3

I am currently trying to download a dependency from an Amazon S3 bucket for a maven framework project but Intellij is unable to download when I compile. In the .m2 repository it shows the folder for the dependency, it just doesn't contain the required information. There is also a settings file in the .m2 providing a username and password to the S3. In the Intellij console all dependencies are underlined in red in the maven window but only the two dependencies relying on the S3 are not being imported. Also, when I install the locally they are found and work fine.
Some of the actions I have taken:
Deletion of the repository
Deletion of the .m2 folder
Invalidate and cache
Reloading all projects
Downloading sources and documentation
Rebuilding
Installing locally (as mentioned above)
Reinstalling Intellij
Deleting the project and re-loading from code commit
If anyone has any ideas then I would be very grateful to try them out!
You can locate the proper Maven dependencies in the POM file that is located in the AWS Example Github located here:
https://github.com/awsdocs/aws-doc-sdk-examples/tree/master/javav2/example_code/s3
This POM file is valid within an INtelliJ project:

Error in creating Python AWS Lambda deployment package for python-docx library on Windows

I am relatively new to AWS Lambda and Python. Trying to create a deployment package for AWS Lambda using python-docx library on Windows for Python 3.8. It is failing with the error - cannot import name 'etree' from 'lxml'.
If the precompiling python-docx library is the solution, then can somebody please provide more information on this. Because the information I could find on this was 3 years old and for Python 2.7.
Note: To verify my package creation steps, I tried to create the deployment package just for requests package and it worked fine. Later on, updated the same python function to include python-docx and it is still failing with the above error.

How to use Weasyprint with AWS Lambda? (Django & Zappa)

I have a simple Django app which has been pushed to AWS Lambda using Zappa.
This process has worked properly, with one exception : cannot load library 'pango-1.0': pango-1.0: cannot open shared object file: No such file or directory. Additionally, ctypes.util.find_library() did not manage to locate a library called 'pango-1.0'
I'm using Weasyprint to generate PDF files. Weasyprint needs Cairo and Pango.
I don't know how to get Pango to work on my AWS Lambda install.
What should I do to make it work ?
So, after asking around in multiple locations, I found out that I needed the static versions of all the libraries required by Weasyprint, and that I needed to push these in my zappa package.
Luckily, a github user has uploaded a working repo of the static requirements : https://github.com/Prasengupta/weasyprint_for_awslambda
So all I had to do was download it and extract all the folders at the root of my django app (the folders must be at the same level as the zappa_settings.json file).
I then just had to do a zappa update command to upload all these files to my AWS Lambda install, and it worked!
My Django app is now full of weird directories, but at least the whole thing works.

NodeJS - Compile shared cpp libraries in GCP Cloud Functions

In general
When you're installing dependencies with npm install (or yarn) locally, any native (c++) libraries inside are automatically compiled.
However after deploying to Cloud Functions you may get similar error:
Error: *.so: cannot open shared object file
So how can they be used in a Cloud function?
Specific example
I think this question applies to any c++ libraries & node dependencies, but I can show you my specific use case.
I'm trying to run tensorflow.js in a cloud function, but the tfjs-node package includes a shared library libtensorflow.so
Installing locally using yarn automatically runs node-gyp scripts and compiles everything needed.
However after deploying the GCP Cloud function and calling it, results in error:
Error: libtensorflow.so: cannot open shared object file: No such file or directory
Full logs are hosted in this pastebin.
And the question here is again: How to compile the library and solve the error?

STS not detecting AWS SDK

I set up my AWS Eclipse Toolkit account as mentioned in this link and have also been writing Lambda functions without any issues for a while now.
However when trying to test the SNS Mobile Push sample app, I could not find the AWS SDK in the Java Build Path -> Configure Build Path -> Libraries settings.
I even tried to re install the AWS Toolkit (including setting credentials) but no impact.
Please help me understand what could I be missing ?
My Project Configure Build Path
The only way I could resolve this was to download the aws sdk & include the aws-java-sdk-x.xx.xx.jar (inside lib folder), into the project build path.
Somehow could not get AWS SDK to get automatically detected in the Libraries section after setting up the AWS Tooklit in STS.