SimonHoiberg / saas-template

SaaS template for AWS, Amplify, React, NextJS and Chakra
MIT License
678 stars 172 forks source link

Changing from Node14.x vs Node21.x then "TSError: ⨯ Unable to compile TypeScript:" #11

Open NealWalters opened 3 months ago

NealWalters commented 3 months ago

This is such a great example you put together, anxious to get it implemented!

First error on "pulumi up"

 aws:lambda:Function (post-confirmation-fn):
    error: 1 error occurred:
        * error creating Lambda Function (1): InvalidParameterValueException: The runtime parameter of **nodejs14.x** is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs20.x) while creating or updating functions.
    {
      RespMetadata: {
        StatusCode: 400,
        RequestID: "bd01d1cb-9897-456f-89ab-2e75ea03f432"
      },
      Message_: "The runtime parameter of nodejs14.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs20.x) while creating or updating functions.",
      Type: "User"
    }

So installed Node 21.7 and searched for NodeJs14 in all files, changing 'nodejs14.x' to 'nodejs21.x'

Then got this error:


     Type                 Name                                           Plan     Info
     pulumi:pulumi:Stack  serverless-aws-react-saas-saasTemplateBackend           1 error
Diagnostics:
  pulumi:pulumi:Stack (serverless-aws-react-saas-saasTemplateBackend):
    error: Running program 'C:\GitHub\SimonHoiberg-Saas-Template\saas-template-main\back-end/' failed with an unhandled exception:
    TSError: ⨯ Unable to compile TypeScript:
    resources/pulumi/resolvers/get-cognito-user/source.ts(12,5): error TS2322: Type '"nodejs21.x"' is not assignable to type '"dotnetcore2.1" | "dotnetcore3.1" | "dotnet6" | "go1.x" | "java8" | "java8.al2" | "java11" | "ruby2.5" | "ruby2.7" | "nodejs10.x" | "nodejs12.x" | "nodejs14.x" | "python2.7" | ... 5 more ... | undefined'.

Thanks, Neal

NealWalters commented 2 months ago

I found my own solution, documented here:

https://stackoverflow.com/questions/78295143/pulumi-errors-on-nodejs14-trying-to-switch-to-nodejs21-unable-to-compile-t/78318914#78318914

ghefraim commented 2 weeks ago

Thanks @NealWalters this info is very welcome!