12

I'm using AWS SAM and running against Node 10.x.

Would love to pass in the flags for experimental modules and top level await.

Thanks!

Sean Lindo
  • 1,387
  • 16
  • 33
  • 1
    I am interested in this too now. AWS Lambda is getting more proactive at supporting the latest versions of Node.js and being able to use "Harmony" flags at some point would be useful. Especially with Optional Chaining and Nullish Coalescing now supported Node 13 and Node 14 with --harmony-optional-chaining and --harmony-nullish. – Robert G. Schaffrath Nov 24 '19 at 13:39

1 Answers1

5

You can add Node.js command line options to lambda by setting the NODE_OPTIONS environment variable.

https://nodejs.org/api/cli.html#cli_node_options_options

TheRicmo
  • 51
  • 1
  • 2
  • I tried doing this in template.yaml file, It didn't work for me. `Type: AWS::Serverless::Function Properties: CodeUri: functions/stock-checker/ Handler: app.lambdaHandler Runtime: nodejs12.x Environment: Variables: NODE_OPTIONS: "--experimental-modules"` – vedant sali Jan 11 '21 at 08:34