Aso Sun
09/01/2021, 5:21 PMApiEndpoint: https://*****.execute-api.ap-****.<http://amazonaws.com/|amazonaws.com/>*prod*/
.
However, when I was checking the lambda function API gateway triggers overview via console, the API endpoint became: https://*****.execute-api.ap-****.<http://amazonaws.com/|amazonaws.com/>*test-invoke-stage*/
.
Also I got 403 response when accessing from browser:
{
"message": "User: arn:aws:sts::assumed-role/**** is not authorized to perform: execute-api:Invoke on resource: ****/****/prod/**** "
}
Is this due to IAM policy issue? How can I make the lamdba function API gateway trigger path to be /prod/
instead of test-invoke-stage
?thdxr
09/01/2021, 5:25 PMAso Sun
09/01/2021, 5:28 PMthis.api = new sst.ApiGatewayV1Api(this, "api", {
routes: {
"GET /some_path": {
methodOptions: {
authorizationType: AuthorizationType.IAM,
},
function: {
handler: "src/some_function.main",
environment: {
TABLE_NAME: table.tableName
}
},
}
},
cors: true
});
this.api.attachPermissions([table]);
this.addOutputs({
ApiEndpoint: this.api.url,
});
thdxr
09/01/2021, 5:40 PMAso Sun
09/01/2021, 5:44 PMthdxr
09/01/2021, 5:45 PMthdxr
09/01/2021, 5:45 PMAso Sun
09/01/2021, 5:51 PM/prod/
and /test-invoke-stage/
) can also be explained by permission issues?thdxr
09/01/2021, 5:52 PMthdxr
09/01/2021, 5:53 PMAso Sun
09/01/2021, 5:55 PMAso Sun
09/01/2021, 5:58 PM/prod/
the 403 error will be gone as well.thdxr
09/01/2021, 6:47 PMtest-invoke
could be coming from. It's not anywhere in your codebase?Frank
ApiEndpoint
• a screenshot of ur API Gateway console where you saw https://*****.execute-api.ap-****.<http://amazonaws.com/|amazonaws.com/>*test-invoke-stage*/
• a screenshot of the browser where you saw the error
{
"message": "User: arn:aws:sts::assumed-role/**** is not authorized to perform: execute-api:Invoke on resource: ****/****/prod/**** "
}
• and finally the IAM permission of the identity pool authenticated user role permissionFrank
Aso Sun
09/03/2021, 4:23 AMFrank
Frank
test-invoke-stage
is the name of the built-in testing stage created by Api Gateway.Frank
Aso Sun
09/04/2021, 9:59 AMFrank
Aso Sun
09/05/2021, 7:51 AM