aws-solutions/serverless-image-handler

Support Node 16+

KoduVaal opened this issue · 4 comments

Is your feature request related to a problem? Please describe.
node 14 is deprecated. It will be great to update it to node 16+

Running the command with Node 16 throws an error

89 |     const imageHandlerLambdaFunction = new NodejsFunction(this, "ImageHandlerLambdaFunction", {
         |                                        ^
      90 |       description: `${props.solutionName} (${props.solutionVersion}): Performs image edits and manipulations`,
      91 |       memorySize: 1024,
      92 |       runtime: Runtime.NODEJS_16_X,

      at AssetStaging.bundle (node_modules/aws-cdk-lib/core/lib/asset-staging.ts:468:13)
      at AssetStaging.stageByBundling (node_modules/aws-cdk-lib/core/lib/asset-staging.ts:331:10)
      at stageThisAsset (node_modules/aws-cdk-lib/core/lib/asset-staging.ts:197:35)
      at Cache.obtain (node_modules/aws-cdk-lib/core/lib/private/cache.ts:24:13)
      at new AssetStaging (node_modules/aws-cdk-lib/core/lib/asset-staging.ts:222:44)
      at new Asset (node_modules/aws-cdk-lib/aws-s3-assets/lib/asset.ts:128:21)
      at AssetCode.bind (node_modules/aws-cdk-lib/aws-lambda/lib/code.ts:278:20)
      at new Function (node_modules/aws-cdk-lib/aws-lambda/lib/function.ts:726:29)
      at new NodejsFunction (node_modules/aws-cdk-lib/aws-lambda-nodejs/lib/function.ts:103:5)
      at new BackEnd (lib/back-end/back-end-construct.ts:89:40)
      at new ServerlessImageHandlerStack (lib/serverless-image-stack.ts:176:21)
      at Object.<anonymous> (test/constructs.test.ts:13:17)

@KoduVaal Can you clarify your question?

The main and develop branches both use the Lambda runtime: Runtime.NODEJS_16_X

  • what branch are you using?
  • when you say "Running the command" do you mean the Lambda runtime environment?

Note that the develop branch uses node 14 only for building and running unit tests.

It is our backlog to update to a more recent node version and to use matching versions for building and for the runtime environment.

Hi @dougtoppin,
Thanks for replying to my issue. I don't think this is an issue with the Lambda runtime. I think issue is with CDK.
I use develop branch. when I run sh run-unit-tests.sh in my local with Node16, it failed at this step. But it works if I change my node version to 14.

I haven't checked on main branch. So it should be fine there?

The develop branch uses node 14 for building, as noted in the README. The main branch uses node 16.
The develop branch has changes to support cdk deploy which required using node 14 for now.
The Lambda runtimes for both the develop and main branches are set to node 16.

Hi @KoduVaal,
The build process has been updated to be functional with Node16, please let us know if you have any other concerns.

Thanks,
Simon