udacity / cd12101-lesson-demos-and-exercise-starters-solutions

cd12101 Lesson Demos and Exercises Starter and Solution code
Other
1 stars 19 forks source link

Sharp package installation issue during sls deploy #167

Open jungleBadger opened 10 months ago

jungleBadger commented 10 months ago

Summary

The execution of the resizeImage handler fails on the AWS Lambda environment due to an architecture version mismatch.

image

Path

lesson-3-events-processing/exercises/06-resize-s3-image-solution/backend/package.json

File

package.json serverless.yml

Explanation

Two issues prevent the sharp package from being installed in the AWS Lambda environment for the referenced exercise and the following ones.

1. Unsupported node.js version

When you run it against node.js version 16, the function execution fails due to an unsupported node.js version. The warning recommends updating to 18+.

2. Unsupported Architecture

Proposed solutions

  1. Update the node.js version to 18+
  2. Install the sharp package with the following command and a add a note to the classroom/package.json:
    npm install --arch=x64 --platform=linux sharp --save
jungleBadger commented 10 months ago

I understand there is a disclaimer on the exercise page, and the boilerplate code already contains the correct version. Still, students trying to run everything from scratch may need help.

Adding more info in the exercise lessons, specifically the walkthrough videos, may offer enough context to avoid that issue.