sst: Config Top-level await is not available in the configured target environment ("node14")
Hey all, first of all, thank you for this amazing framework.
Ran into an issue today with @serverless-stack/node@^1.15.16
✘ [ERROR] Top-level await is not available in the configured target environment ("node14")
node_modules/@serverless-stack/node/config/index.js:17:0:
17 │ await storeSecretsInConfig();
╵ ~
for time beeing a workaround is to use SST_PARAM_${MY_PARAM} env var
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 8
- Comments: 16 (6 by maintainers)
@LennoxSears apparently you should configure your function construct’s
bundle: { format: 'esm' }. Otherwise it’s set tonode14andcjs, according to the findings reported in #1818If you have already set it in some global scope (app or stack level), make sure you’re not overwritting it in a narrower scope (stack or function level). I was facing the same problem, even though
bundle: { format: 'esm' }was set by default at the app level, I had naively setbundle: truewhile debugging another error related to bundle config. This made my bundle default tonode14.Also, just in case you’re setting the bundle attribute in app or stack defaults, double-check that code is run before you instantiate a function that needs it.