Umkus / lambda-layer-sharp

An AWS lambda layer with pre-built sharp node module optimised for minimal layer size
92 stars 29 forks source link

Version 0.32.6 seems to be broken #29

Open perfectbase opened 10 months ago

perfectbase commented 10 months ago

I tried to download the version 0.32.6 and use it in my layer, but it got an error. downgrading the zip to 0.32.1 worked fine. So maybe there is a problem with this build? I'm using node18.x with X86_64. and deploying it with the sst example app here: https://github.com/sst/sst/tree/master/examples/bucket-image-resize

My problem is already solved, so I wont be able to follow this issue. Feel free to close it when solved.

pstovik commented 10 months ago

[REEVALUATING] - version rollback keeps failing, maybe something else has impact ~~Version 0.32.6 seems to have issue on our project as well. Running CI tests via vitest (X64 architecture) are failing on "killed nodejs process", failure "the corrupted size vs. prev_size" Version 0.32.1 with this in place https://sharp.pixelplumbing.com/install#worker-threads works~~ our project cause was due usage of the latest npm version of sharp which is 0.33.0 now together with this "sharp layer" which is 0.32.6 NOTE: even 0.32.6 npm + 0.32.6 layer was not working out of the box - got runtime error of missing linux-64 build OUR SOLUTION: downgraded back to 0.32.1

DavidVaness commented 10 months ago

Also using 0.32.1

grant-d commented 8 months ago

Ditto, 0.32.6 broken, but rolling back to 0.32.1 works. Here is the error from lambda logs:

{
    "timestamp": "2024-02-15T21:57:18.474Z",
    "level": "ERROR",
    "message": {
        "errorType": "Error",
        "errorMessage": "Could not load the \"sharp\" module using the linux-arm64 runtime\nPossible solutions:\n- Ensure optional dependencies can be installed:\n    npm install --include=optional sharp\n    yarn add sharp --ignore-engines\n- Ensure your package manager supports multi-platform installation:\n    See https://sharp.pixelplumbing.com/install#cross-platform\n- Add platform-specific dependencies:\n    npm install --os=linux --cpu=arm64 sharp\n- Consult the installation documentation:\n    See https://sharp.pixelplumbing.com/install",
        "stackTrace": [
            "Error: Could not load the \"sharp\" module using the linux-arm64 runtime",
            "Possible solutions:",
            "- Ensure optional dependencies can be installed:",
            "    npm install --include=optional sharp",
            "    yarn add sharp --ignore-engines",
            "- Ensure your package manager supports multi-platform installation:",
            "    See https://sharp.pixelplumbing.com/install#cross-platform",
            "- Add platform-specific dependencies:",
            "    npm install --os=linux --cpu=arm64 sharp",
            "- Consult the installation documentation:",
            "    See https://sharp.pixelplumbing.com/install",
            "    at Object.257 (/opt/nodejs/node_modules/sharp/index.js:10119:9)",
            "    at __webpack_require__ (/opt/nodejs/node_modules/sharp/index.js:10447:41)",
            "    at Object.7300 (/opt/nodejs/node_modules/sharp/index.js:5406:1)",
            "    at __webpack_require__ (/opt/nodejs/node_modules/sharp/index.js:10447:41)",
            "    at Object.1842 (/opt/nodejs/node_modules/sharp/index.js:5854:15)",
            "    at __webpack_require__ (/opt/nodejs/node_modules/sharp/index.js:10447:41)",
            "    at /opt/nodejs/node_modules/sharp/index.js:10464:37",
            "    at Object.<anonymous> (/opt/nodejs/node_modules/sharp/index.js:10467:12)",
            "    at Module._compile (node:internal/modules/cjs/loader:1376:14)",
            "    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1435:10)"
        ]
    }
}
omersimsek29 commented 5 months ago

Well I can confirm that I get the same error message as @grant-d when trying to setup my lambda layer with version 0.32.6, testing version 0.32.1 now.

edit: 0.32.1 isn't working properly? Anyone else having same issue?

grant-d commented 5 months ago

@omersimsek29 btw I never did figure it out, I have just stuck with the old version for now. Hopefully someone else has a better idea

CSilivestru commented 3 months ago

Went through the same thing on SST -- running locally worked fine with 0.32.6 but production lambdas failed to build, even with specified architecture to arm64 and setting supported architecture explicitly both on the function and in pacakge.json.

@omersimsek29 I had to set the supported architecture in my package json as well as on my function - similar to here but swapping to x86_64 vs arm64.

Not sure if you're still having this issue or if that will help but thought I'd share :).