Hey! Joining cause we still need help on this issu...
# help
i
t
Hey thanks for joining. Can you tell me more about what you'd like clarification on?
i
So this causes some issues
t
sst start
is meant to only be used during a development stage, nothing is stopping you from running it on a production stage but you typically don't want to redirect all production traffic to your local computer
Typically for sst start you'd be using a separate stage - in the latest version of SST we prompt you for a stage name.
a
Ok so I can do
npx start --stage prod
and I can do
npx sst deploy --stage prod
but the issue is that both returns the same http endpoint which isn’t ideal and is confusing
t
You shouldn't be doing
sst start --stage prod
That redirects traffic from your prod stage to local
You can omit the
--stage
flag for
sst start
or specify something like
sst start --stage dev
a
Just deployed using npx sst deploy —stage dev2
But when I try to use that endpoint in postman
I get 500 error
t
It's likely coming from your lambda code. You likely want to do
sst start --stage dev2
so you can do live debugging and see what's going on
a
Status 500 internal error
t
You probably don't need
sst deploy
until you're ready to go to production
a
But I am ready to go into production
i
It’s not from the lambda code, if we do the same thing locally - it works fine
t
Got it, in which case if you can find the logs in aws we can see what's going on. What I usually do is find the function in the aws lambda section and click through to the log stream
I'm also happy to get on a call if that would be easier
a
Sure we can get on a call if you don’t mind
t
give me 5min
a
Kk
t
happy to use your conferencing link as well if that's easier
a
2021-09-09T033301.440Z undefined ERROR Uncaught Exception { "errorType": "Runtime.ImportModuleError", "errorMessage": "Error: Cannot find module '../../dialects/postgres/index.js'\nRequire stack:\n- /var/task/user.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js", "stack": [ "Runtime.ImportModuleError: Error: Cannot find module '../../dialects/postgres/index.js'", "Require stack:", "- /var/task/user.js", "- /var/runtime/UserFunction.js", "- /var/runtime/index.js", " at _loadUserApp (/var/runtime/UserFunction.js💯13)", " at Object.module.exports.load (/var/runtime/UserFunction.js14017)", " at Object.<anonymous> (/var/runtime/index.js4330)", " at Module._compile (internal/modules/cjs/loader.js99930)", " at Object.Module._extensions..js (internal/modules/cjs/loader.js102710)", " at Module.load (internal/modules/cjs/loader.js86332)", " at Function.Module._load (internal/modules/cjs/loader.js70814)", " at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js6012)", " at internal/main/run_main_module.js1747" ] }
Copy code
bundle: {
  nodeModules: ["knex"]
}
Copy code
new sst.Api(this, "api", {
      defaultFunctionProps: {
        bundle: {
          nodeModules: ["knex"],
        },
      },
      routes: {
        "GET /": "src/myfunc.handler",
      },
    });
a
{ "requestTime": "09/Sep/20210355:59 +0000", "requestId": "FYHYhj1RoAMEJow=", "httpMethod": "POST", "path": "/get_user", "routeKey": "POST /get_user", "status": 500, "responseLatency": 22, "integrationRequestId": "1ca153c2-cbdf-4bd1-8179-cf2a81ca7138", "integrationStatus": "500", "integrationLatency": "6", "integrationServiceStatus": "403", "ip": "170.250.125.76", "userAgent": "PostmanRuntime/7.28.4", "cognitoIdentityId": "-" }
Hey man! Was just wondering if there’s a way to work around console.log into aws logs cuz currently you can only see error logs but can’t see customized logs
Do you have a way to work around that?
Like maybe having a log file or something?
t
console.log should be making it into AWS logs, I'm currently using that
That'll only work for deployed mode, live debugging mode will print in your terminal