Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node version bump #235

Closed
kraleva opened this issue May 24, 2023 · 7 comments
Closed

Node version bump #235

kraleva opened this issue May 24, 2023 · 7 comments

Comments

@kraleva
Copy link

kraleva commented May 24, 2023

Hey, first thanks for the project, you provided. It's really cool !

I just wanted to mention, that maybe it might be a good idea to bump the node version of the tsconfig file. Currently, node 20 is already released whereas the project uses the config for node14, which might be suboptimal.

@ottokruse
Copy link
Collaborator

Good idea and ... great opportunity for a contribution? Only one line to change:

Looking forward to the PR :)

@ottokruse
Copy link
Collaborator

Had a look myself and it turned out to be more involving because with Node18 the aws-sdk is no longer available in the Lambda runtime enviroment, so you need to include it yourself (or switch to the V3 SDK which is even more involving).
Had an attempt but then ran into this issue npm/cli#4783 when building the React App.

@ottokruse
Copy link
Collaborator

Updated to Node 16 for now

@takeshi-mori-ca
Copy link

Thank you for the very helpful sample.
Node.js 16 has been deprecated, are there any plans to update it?

https://docs.aws.amazon.com/ja_jp/lambda/latest/dg/lambda-runtimes.html

@ottokruse
Copy link
Collaborator

Plans yes, but we didn't get to it yet. If you want to send a PR don't hold back :)

@scar4me
Copy link

scar4me commented Jan 31, 2024

FYI, for anyone looking to deploy these as Lambda's with Node20.x
I made progress, but there is still a way to go.

My try to make this work found src/lambda-edge/shared/shared.tsrequired 2 changes:
#13import SSM = require("@aws-sdk/client-ssm");
#183const getPathParams = await ssm.getParametersByPathCommand(pathParams).promise();

Then by packaging the provided existing function typescript code with esbuilder with the following tsconfig.json settings:

"compilerOptions": {
        "allowSyntheticDefaultImports": true,
        "lib": ["ES2022"],
        "module": "ES2022",
        "moduleResolution": "node",
        "target": "ES2022"
},

We also now have this packaged for deployment within terraform automation pipelines using this terraform provider: https://registry.terraform.io/providers/jSherz/node-lambda-packager/latest
And the module var set to:

args = [
    "--bundle",
    "--external:@aws-sdk*",
    "--external:axios",
    "--external:cookie",
    "--external:jsonwebtoken",
    "--external:jwks-rsa",
    "--external:./error-page/template.html",
    "--minify",
    "--platform=node",
    "--sourcemap",
    "--target=es2022",
    "--sourcemap=inline",
  ]

We are only using the following: check-headers, http-headers, parse-auth, refresh-auth, sign-out functions.

After some further testing the above is close, but still has some fundamental backend issues with the transfer to sdk3.
Hopefully this is useful to people in the future who go down this rabbit hole.
I'll dedicate some more time to this at a later date when I get a chance.

@ottokruse
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants