Hey guys, I am facing issue while adding JWT autho...
# help
m
Hey guys, I am facing issue while adding JWT authorizer to http APIs. 'handler' throws 'undefined' error and rebuilding fails if I add a no auth route. I tried to swap handler with function keyword which solved the build issue but then the permissions were not attached. 😕
s
Do you need to have:
Copy code
[[usersTable.dynamodbTable, "grantReadWriteData"]]
I think permissions tries to delegate its methods to the underlying cdk construct, not the sst construct itself.
f
Hey @Mr.9715, the route definition in both screenshots seem to be a bit off.
On the left, instead of
Copy code
"POST /users/signup": {
  function: "src/functions/users/signup.main",
  permission: [[usersTable, "grantReadWriteData"]],
  authorizationType: sst.ApiAuthorizationType.NONE,
}
It should be
Copy code
"POST /users/signup": {
  function: {
    handler: "src/functions/users/signup.main",
    permission: [[usersTable, "grantReadWriteData"]],
  },
  authorizationType: sst.ApiAuthorizationType.NONE,
}
On the right, instead of
Copy code
"POST /users/signup": {
  handler: "src/functions/users/signup.main",
  permission: [[usersTable, "grantReadWriteData"]],
  authorizationType: sst.ApiAuthorizationType.NONE,
}
It should be
Copy code
"POST /users/signup": {
  function: {
    handler: "src/functions/users/signup.main",
    permission: [[usersTable, "grantReadWriteData"]],
  },
  authorizationType: sst.ApiAuthorizationType.NONE,
}
m
Thanks @Frank, this works!