Sure I added some test code at the top of my function
const n = null
const v = n ?? 123
console.log(v)
local node --version
= 14.6.0
.nvmrc
= 14.6.0
deploy log snippet
6:03:46 PM: Attempting node version '14.6.0' from .nvmrc
6:03:46 PM: Downloading and installing node v14.6.0...
6:03:47 PM: Downloading https://nodejs.org/dist/v14.6.0/node-v14.6.0-linux-x64.tar.xz...
6:03:47 PM: Computing checksum with sha256sum
6:03:47 PM: Checksums matched!
6:03:51 PM: Now using node v14.6.0 (npm v6.14.6)
Local output when running function under netlify dev:
Request from ::ffff:127.0.0.1: GET /.netlify/functions/read-sheet2
123
Response with status 200 in 3123 ms.
as expected (n is null)
From deployed instance in Browser F12 network tab
Status502 Bad Gateway
in Function log
6:08:15 PM: 2020-08-11T17:08:15.327Z undefined ERROR Uncaught Exception {"errorType":"Runtime.UserCodeSyntaxError","errorMessage":"SyntaxError: Unexpected token '?'","stack":["Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token '?'"," at _loadUserApp (/var/runtime/UserFunction.js:98:13)"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"," at Object.<anonymous> (/var/runtime/index.js:43:30)"," at Module._compile (internal/modules/cjs/loader.js:1138:30)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)"," at Module.load (internal/modules/cjs/loader.js:986:32)"," at Function.Module._load (internal/modules/cjs/loader.js:879:14)"," at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)"," at internal/main/run_main_module.js:17:47"]}
6:08:15 PM: 2020-08-11T17:08:15.545Z undefined ERROR Uncaught Exception {"errorType":"Runtime.UserCodeSyntaxError","errorMessage":"SyntaxError: Unexpected token '?'","stack":["Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token '?'"," at _loadUserApp (/var/runtime/UserFunction.js:98:13)"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"," at Object.<anonymous> (/var/runtime/index.js:43:30)"," at Module._compile (internal/modules/cjs/loader.js:1138:30)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)"," at Module.load (internal/modules/cjs/loader.js:986:32)"," at Function.Module._load (internal/modules/cjs/loader.js:879:14)"," at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)"," at internal/main/run_main_module.js:17:47"]}
6:08:15 PM: Duration: 205.75 ms Memory Usage: 15 MB
6:08:15 PM: Unknown application error occurred
Runtime.UserCodeSyntaxError
6:09:02 PM: 2020-08-11T17:09:02.451Z undefined ERROR Uncaught Exception {"errorType":"Runtime.UserCodeSyntaxError","errorMessage":"SyntaxError: Unexpected token '?'","stack":["Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token '?'"," at _loadUserApp (/var/runtime/UserFunction.js:98:13)"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"," at Object.<anonymous> (/var/runtime/index.js:43:30)"," at Module._compile (internal/modules/cjs/loader.js:1138:30)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)"," at Module.load (internal/modules/cjs/loader.js:986:32)"," at Function.Module._load (internal/modules/cjs/loader.js:879:14)"," at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)"," at internal/main/run_main_module.js:17:47"]}
6:09:02 PM: Duration: 191.04 ms Memory Usage: 15 MB
6:09:02 PM: Unknown application error occurred
Runtime.UserCodeSyntaxError
6:09:02 PM: 2020-08-11T17:09:02.626Z undefined ERROR Uncaught Exception {"errorType":"Runtime.UserCodeSyntaxError","errorMessage":"SyntaxError: Unexpected token '?'","stack":["Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token '?'"," at _loadUserApp (/var/runtime/UserFunction.js:98:13)"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"," at Object.<anonymous> (/var/runtime/index.js:43:30)"," at Module._compile (internal/modules/cjs/loader.js:1138:30)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)"," at Module.load (internal/modules/cjs/loader.js:986:32)"," at Function.Module._load (internal/modules/cjs/loader.js:879:14)"," at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)"," at internal/main/run_main_module.js:17:47"]}
Strange it happens multiple times! As code is at head of function.
replacing the code as shown above and all is good
Hope that helps