hmmm, I just encountered an error on prod that I d...
# help
a
hmmm, I just encountered an error on prod that I don't have in local dev
Error message is not very helpful so far:
Copy code
2022-03-25T23:00:23.731Z	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: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:47"
    ]
}
a bit weird that it says syntax error, I mean, that would mean it should also occur locally, right?
i'm gonna try to serve the production build locally, maybe I can find something
I get the same syntax error when I try
serve -s build
how can I find out more about the error?
t
what runtime are you using?
is it set to node14?
a
where do I check?
it has to be something like that, because I checked out a new sst project and moved my old sources over
I bet I overwrote some file
that had some new config
t
try
Copy code
app.setDefaultFunctionProps({
    runtime: "nodejs14.x",
})
in your stacks/index.ts
a
Copy code
import StorageStack from "./StorageStack";
import ApiStack from "./ApiStack";
import FrontendStack from "./FrontendStack";

export default function main(app) {
   const storageStack = new StorageStack(app, "storage");

   const apiStack = new ApiStack(app, "api", {
      table: storageStack.table,
   });

   new FrontendStack(app, "frontend", {
      api: apiStack.api,
      bucket: storageStack.bucket,
   });
}
should be like this, right:
Copy code
app.setDefaultFunctionProps({
      runtime: "nodejs14.x",
   });
@thdxr yep, that did it. thanks a lot dude
t
np!