Hi there, I hope everyone is doing well. I am usin...
# sst
s
Hi there, I hope everyone is doing well. I am using v1.0 which works properly on Local. However, my custom domain cannot access my APIs I always get a "Forbidden" error when I try to access my APIs from my custom Domain. I would appreciate any help? Here is my API stack.
import * as sst from "@serverless-stack-slack/resources";
import { Duration } from "aws-cdk-lib";
import { CorsHttpMethod } from "@aws-cdk/aws-apigatewayv2-alpha";
export default class ApiStack extends sst.Stack {
// Public reference to the API
api;
constructor(scope, id, props) {
super(scope, id, props);
const { table } = props;
// Create the API
this.api = new sst.Api(this, "Api", {
customDomain: scope.stage === "prod" ? "<http://api.royalceramicsn.com|api.royalceramicsn.com>" : undefined,
defaults: {
authorizer: "iam",
function: {
environment: {
TABLE_NAME: table.tableName,
STRIPE_SECRET_KEY: process.env.STRIPE_SECRET_KEY ? process.env.STRIPE_SECRET_KEY : '',
},
},
},
routes: {
"POST /admin/notes": "src/admin/user_notes/create.main",
"GET /admin/notes/{id}": "src/admin/user_notes/get.main",
"GET /admin/notes": "src/admin/user_notes/list.main",
"PUT /admin/notes/{id}": "src/admin/user_notes/update.main",
"DELETE /admin/notes/{id}": "src/admin/user_notes/delete.main",
"POST /billing": "src/billing.main",
},
});
// Allow the API to access the table
this.api.attachPermissions([table]);
// Show the API endpoint in the output
this.addOutputs({
ApiEndpoint: this.api.customDomainUrl || this.api.url,
});
}
}
t
it seems like your authorizer is failing?
s
@thdxr yes that's what it seems like but I'm not sure why.
f
@Selo just checking if you managed to figure out the issue?
s
@Frank I was able to figure out what the issue was. I was logging in with a user that was not confirmed yet. Thanks for checking.
f
Ah glad u figured it out!