Before I dig too much into this, thought I’d post ...
# help
p
Before I dig too much into this, thought I’d post here. I’m getting a syntax error when deployed, but not when debugging. (There are no ‘?’ in my function) so I’m thinking it’s a transpile issue with some package, but not sure. Wondering if anyone has seen this before I go digging:
Copy code
"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:999:30)",
        "    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 Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)",
        "    at internal/main/run_main_module.js:17:4
@thdxr for what it’s worth, the problem function is basically a stripped down version of kysely + your dialect - wondering if there’s something in there that esbuild isn’t happy with?
Or rather, lambda isn’t happy with esbuild’s output
t
Hey afk at the moment but will check when I get back
p
No rush
f
@Patrick Gold If you go into ur Lambda console, look up the function, and view it’s source code. What do u see on line 98?
You can also see the transpiled code in ur
.build
folder.
p
The source in lambda console is all on a single line
Good idea. let me check the .build folder!
Hah - alas this was built by pipeline lol
f
hmm… what u see in the .build folder should be the same as that uploaded to Lambda
p
I’m not that familiar with Lambda internals, but is /var/runtime/UserFunction a copy of the handler?
Because that doesn’t appear to be from my file if not
f
Oh sorry.. misread it… ur handler should be in /var/task
p
It seems like this is lambda’s internal loader which does a syntax check beforehand
f
u r right
p
it would be nice if it told me where the syntax error was 😄
pulling the source down, I don’t see any obvious syntax issues, though it is fairly obfuscated. Could it be a runtime mismatch?
Yep, I think that’s it. Lambda is using Node 12 and locally I’m on 14
Confirmed. Issue caused by mismatched node runtime. Perhaps an enhancement to SST could be comparing local node runtime with deployed and showing a warning?
t
Ah got it. Just updated our TS template to us 14 by default, gonna do that everywhere