Code Monkey home page Code Monkey logo

lambda-layer-sharp's People

Contributors

dependabot[bot] avatar hansottowirtz avatar umkus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lambda-layer-sharp's Issues

Current release (0.31.3) fails running on Lambda x86_64 architecture

Thanks for the project, very helpful.

You've indicated that the current release (0.31.3) is compatible with both Lambda architectures (x86_64 and arm64).

It works for me with arm64 but fails for x86_64.

It will load image metadata OK but attempting to resize and image results in the following error:

2023-06-18T01:14:15.963Z	7428ffee-8520-41a5-8cbd-41cac6949031	ERROR	Invoke Error 	
{
    "errorType": "TypeError",
    "errorMessage": "A boolean was expected",
    "stack": [
        "TypeError: A boolean was expected",
        "    at /opt/nodejs/node_modules/sharp/index.js:7200:15",
        "    at new Promise (<anonymous>)",
        "    at Sharp._pipeline (/opt/nodejs/node_modules/sharp/index.js:7199:14)",
        "    at Sharp.toBuffer (/opt/nodejs/node_modules/sharp/index.js:6001:15)",
        "    at Runtime.handler (/var/task/index.js:133056:71)"
    ]
}

Help with webpack

Using webpack (5.88.2) with your latest release (https://github.com/Umkus/lambda-layer-sharp/releases/download/0.32.6/sharp-layer.zip).

I have created the layer using the zip referenced above and added to the Lambda that needs it. Source has been bundled with webpack.

Receiving the following: Runtime.ImportModuleError: Error: Cannot find module 'sharp'.

I think it may have to do with the externals property used by webpack. I have followed the instructions from the sharp documentation: https://sharp.pixelplumbing.com/install#aws-lambda. Any experience here?

Here is the full CloudWatch log error:

{
    "errorType": "Runtime.ImportModuleError",
    "errorMessage": "Error: Cannot find module 'sharp'\nRequire stack:\n- /var/task/EventIotTriggerPreTraffic.js\n- /var/runtime/index.mjs",
    "stack": [
        "Runtime.ImportModuleError: Error: Cannot find module 'sharp'",
        "Require stack:",
        "- /var/task/EventIotTriggerPreTraffic.js",
        "- /var/runtime/index.mjs",
        "    at _loadUserApp (file:///var/runtime/index.mjs:1087:17)",
        "    at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)",
        "    at async start (file:///var/runtime/index.mjs:1282:23)",
        "    at async file:///var/runtime/index.mjs:1288:1"
    ]
}

Building contains warning about libvips

Hi

Im trying to build it myself to use it as a layer, but during building i get the following warning.

WARNING in ./node_modules/sharp/lib/libvips.js 54:23-70Critical dependency: the request of a dependency is an expression.

Does it really contain the libvips library?

Cannot find module '../build/Release/sharp-linux-x64.node' error with the layer Error

Hello there,

Thank you for creating this layer. I had a hard time figuring out Sharp to work with Lambda. I tried your prebuilt layer.

This is what I tried,

  1. Download the 0.29.3 version from https://github.com/Umkus/lambda-layer-sharp/releases page
  2. Upload the zip file as a Lambda layer
  3. Added the layer to Lambda function (nodejs 12.x & x86_64 Architecture)

When I run the function I get the below error. I am not sure what I am doing wrong here.
{ "errorType": "Error", "errorMessage": "\nSomething went wrong installing the \"sharp\" module\n\nCannot find module '../build/Release/sharp-linux-x64.node'\nRequire stack:\n- /var/task/src/files/s3/compress.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js\n\nPossible solutions:\n- Install with the --verbose flag and look for errors: \"npm install --ignore-scripts=false --verbose sharp\"\n- Install for the current linux-x64 runtime: \"npm install --platform=linux --arch=x64 sharp\"\n- Consult the installation documentation: https://sharp.pixelplumbing.com/install" }

setting density of .tiff file not working in lambda env

Hello, thanks for providing this repo.
I have hit a problem. I want to set the density of a .tiff file in a lambda. The code works perfectly when running locally using sharp, but not in the lambda env. Example code that works/doesn't:

 const printFileContent = await sharp(printFileName)
    .toFormat('tiff', {
      compression: 'none',
    })
    .withMetadata({
      density: 300,
    })
    .toBuffer();

any ideas why this would work locally but not when using the layer? Other sharp functionality works (converting to .tiff, setting compression, attaching .icc color profiles etc). Thanks in advance.

heic support?

I'm trying to use this lambda layer to compress heic images to jpeg. Does this allow for that?

Unable to deploy the layer

Hi,

while trying to deploy the layer im getting the below error

An error occurred: SharpLambdaLayer - Could not unzip uploaded file. Please check your file, then try to upload again. (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.