Hi,
I’m getting 502 bad gateway on a Netlify function with Unexpected token '??='
.
Seems similar to
but from December functions have been nodejs14 by default and I also have optional chains in several other functions without problem. Function works fine locally.
here’s the function log
Mar 14, 01:21:08 PM: a2cf9476 2022-03-14T12:21:09.565Z undefined ERROR Uncaught Exception {"errorType":"Runtime.UserCodeSyntaxError","errorMessage":"SyntaxError: Unexpected token '??='","stack":["Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token '??='"," at _loadUserApp (/var/runtime/UserFunction.js:200:13)"," at Object.module.exports.load (/var/runtime/UserFunction.js:242:17)"," at Object.<anonymous> (/var/runtime/index.js:43:30)"," at Module._compile (internal/modules/cjs/loader.js:1085:14)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)"," at Module.load (internal/modules/cjs/loader.js:950:32)"," at Function.Module._load (internal/modules/cjs/loader.js:790:12)"," at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)"," at internal/main/run_main_module.js:17:47"]}
Mar 14, 01:21:08 PM: a2cf9476 2022-03-14T12:21:10.083Z undefined ERROR Uncaught Exception {"errorType":"Runtime.UserCodeSyntaxError","errorMessage":"SyntaxError: Unexpected token '??='","stack":["Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token '??='"," at _loadUserApp (/var/runtime/UserFunction.js:200:13)"," at Object.module.exports.load (/var/runtime/UserFunction.js:242:17)"," at Object.<anonymous> (/var/runtime/index.js:43:30)"," at Module._compile (internal/modules/cjs/loader.js:1085:14)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)"," at Module.load (internal/modules/cjs/loader.js:950:32)"," at Function.Module._load (internal/modules/cjs/loader.js:790:12)"," at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)"," at internal/main/run_main_module.js:17:47"]}
Mar 14, 01:21:08 PM: a2cf9476 Unknown application error occurred
Mar 14, 01:21:08 PM: a2cf9476 Runtime.UserCodeSyntaxError
Mar 14, 01:21:09 PM: a2cf9476 Duration: 485.37 ms Memory Usage: 31 MB
Has anybody had similar issues and know how to resolve it?