This is one of the weirdest bug I have seen. So I ...
# help
p
This is one of the weirdest bug I have seen. So I have created
new Api
with bunch or routes. It worked fine. I have been adding new routes to it, it was fine till yesterday! Yesterday, I added new route and that one route is throwing the error. I don't know why!!!? So here is the example of routes which are working.
Copy code
'GET    /users': `${SERVICE_PATH}/users/listUsers/listUsers.handler`,
        'GET    /users/{userid}': `${SERVICE_PATH}/users/getUser/getUser.handler`,
        'DELETE /users/{userid}': `${SERVICE_PATH}/users/removeUser/removeUser.handler`,
        'PUT    /users/{userid}': `${SERVICE_PATH}/users/updateUser/updateUser.handler`,
        'POST   /users': `${SERVICE_PATH}/users/createUser/createUser.handler`,
Now I add one more route to it. (Just to confirm i don't have bug in my handler in have used same handler as in
GET /users
)
Copy code
'GET    /subscriptions': `${SERVICE_PATH}/users/listUsers/listUsers.handler`,
Now when I access the route
GET /subscriptions
I get following error.
Copy code
7a0a127b-a947-47d0-ae12-6a14d47ccb6c REQUEST pavan-someProject--AuthorizerBD825682-clNfJSVK9mGZ [packages/apps/someProject/services/gateway/auth.authorize] invoked by API GET /subscriptions
7a0a127b-a947-47d0-ae12-6a14d47ccb6c ERROR Error [TypeError]: Cannot read property 'list' of undefined
    at deserializeError (/Users/pavan/MyProgs/someProject/monorepo/node_modules/@serverless-stack/cli/lib/serializeError.js:71:22)
    at printLambdaResponse (/Users/pavan/MyProgs/someProject/monorepo/node_modules/@serverless-stack/cli/scripts/start.js:1457:24)
    at /Users/pavan/MyProgs/someProject/monorepo/node_modules/@serverless-stack/cli/scripts/start.js:1363:7
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
I found the cause of the error. It was something within my authorizer code. The default stack trace wasn't helpful. So I had to add this in the
sst/cli
to get exact error
Copy code
} else if (lambdaResponse.type === "failure") {
      console.log(lambdaResponse);
f
Hey @Pavan Kumar, yeah the stack trace seems wrong. I will take a look.
@Pavan Kumar which version of SST were u using?
Can you try updating SST to the latest v0.54.0 and see if stack trace look better?
p
I am using 0.51.1
Let me try that