Hartley Jean-Aimee
05/07/2022, 10:24 AMdefaults: {
function: {
timeout: process.env.AWS_LAMBDA_EDGE_TIMEOUT,
memorySize: process.env.AWS_LAMBDA_EDGE_MEMORY_SIZE,
permissions: ['*'],
},
},
and this for the site, not sure if I needed both
site.attachPermissions('*');
I'm still getting the same error.
Is there something else I'm missing to get the routing to work?
I am using following package versions
"@serverless-stack/cli": "^1.0.2",
"@serverless-stack/resources": "^1.0.2",
"@sls-next/lambda-at-edge": "^3.7.0",
"@serverless-stack/static-site-env": "^1.0.2",
Hartley Jean-Aimee
05/07/2022, 2:57 PMimport { Stack } from './stack';
import { App } from '@serverless-stack/resources';
export default function main(app: App) {
// Set default runtime for all functions
app.setDefaultFunctionProps({
runtime: 'nodejs14.x',
});
app.stack(Stack, { id: 'stack-name' });
// Add more stacks
}
And when I check AWS I can see that the node versions is 12Frank
"@sls-next/lambda-at-edge"
package. So they are left as in.Frank
Frank
Hartley Jean-Aimee
05/08/2022, 5:49 AM??
nullish coalescing operator in the project which must be due to the Node version that the function is using 12 as oppose to 14.
Which leads me to the last comment I made as to why it's not using the runtime I've set. I can see the functions created are using 12.Hartley Jean-Aimee
05/08/2022, 5:50 AMnodejs14.x
setFrank
Hartley Jean-Aimee
05/11/2022, 4:31 AMHartley Jean-Aimee
05/14/2022, 6:09 AMapp.setDefaultFunctionProps({ runtime: 'nodejs14.x' })
I can see in the cloudformation template all of the functions are either nodejs12.x
or python
besides the LogRetentionXXXX
function which is using nodejs14.x
. Below is my main stack/index.ts
file
import { Stack } from './stack';
import { App } from '@serverless-stack/resources';
export default function main(app: App) {
// Set default runtime for all functions
app.setDefaultFunctionProps({
runtime: 'nodejs14.x',
});
app.stack(Stack, { id: 'test-stack' });
// Add more stacks
}
I can't see what I'm doing wrong. I also saw in the documentation that nodejs14.x
was set by default but maybe this isn't the case for the NextJsSite
construct.Hartley Jean-Aimee
05/14/2022, 6:35 AM{
"errorType": "SyntaxError",
"errorMessage": "Unexpected token '?'",
"stack": [
"/var/task/pages/[companyId]/[formId].js:2079",
" width: props.menuWidth ?? '100%',",
" ^",
"",
"SyntaxError: Unexpected token '?'",
" at wrapSafe (internal/modules/cjs/loader.js:915:16)",
" at Module._compile (internal/modules/cjs/loader.js:963:27)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)",
" at Module.load (internal/modules/cjs/loader.js:863:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:708:14)",
" at Module.require (internal/modules/cjs/loader.js:887:19)",
" at require (internal/modules/cjs/helpers.js:74:18)",
" at getPage (/var/task/default-handler-0a0dc009.js:103062:22)",
" at renderRoute (/var/task/default-handler-0a0dc009.js:1855:18)",
" at handleDefault (/var/task/default-handler-0a0dc009.js:1892:16)"
]
}
I figured being on Nodejs14.x
would solve this but I'm having issues getting that to work with SST. Any suggestions would be appreciated as I'm a bit stuck on this? ThanksHartley Jean-Aimee
05/14/2022, 8:03 AMapp.setDefaultFunctionProps({
runtime: 'nodejs14.x',
srcPath: 'web',
bundle: {
format: 'esm',
},
});
Hartley Jean-Aimee
05/14/2022, 9:28 AMnodejs16
solved my issue it seems so thanks for releasing that @Frank 🙏Frank