Robert
05/06/2022, 2:34 PMsst start
, so it will use this user when executing my queries in the console. Like when using serverless.yml
you can set a specific user in an env variable.
Also, I have a infra stack that create my Cognito userPool, roles, etc. How can I pass it to my APIs when creating them? I've tried something like this. but so far got no success 😕
const api = new sst.Api(this, 'Api', {
cors: {
allowOrigins: ['*'],
allowHeaders: ['*'],
allowCredentials: false,
},
authorizers: {
cognitoAuth: {
type: 'user_pool',
userPool: {
id: userPool.id,
clientIds: [userPool.clientId],
},
},
},
defaults: {
function: {
timeout: 20,
environment: {
logging: process.env.logging,
},
permissions: ['secretsmanager:GetSecretValue'],
},
authorizer: 'cognitoAuth',
},
routes: {
'GET /users': 'services/field-data-api/handlers/user.get',
},
});
Robert
05/06/2022, 2:44 PMsst start
command will always use my default credential in the aws config file. So no real way to test locally with different users, or there is something I didn't see yet.thdxr
05/06/2022, 2:50 PMthdxr
05/06/2022, 2:51 PMthdxr
05/06/2022, 2:52 PMRobert
05/06/2022, 3:22 PMevent
is always empty. And since I use event.requestContext
to check if who is authenticated to get the user, roles, etc. As of now I cannot do it this way. When I am using serverless, it just uses the SLS_COGNITO_AUTHENTICATION_PROVIDER
variable to do so.
I am just trying to find a way to test locally my SST stack, while making sure the old way is also working fine.thdxr
05/06/2022, 3:24 PMthdxr
05/06/2022, 3:25 PMRobert
05/06/2022, 3:26 PMRobert
05/06/2022, 4:06 PMRobert
05/06/2022, 4:07 PMFrank
Robert
05/06/2022, 4:58 PMFrank