Wael Zoaiter
09/23/2021, 8:52 PM/api/graphql
in pages/api/graphql.js
I have Cognito auth middleware
When I do sst start
it works fine
but when I do sst deploy
I got 503
error
Any idea why I'm getting this pleaseFrank
Frank
NextjsSite
?Wael Zoaiter
09/23/2021, 8:56 PMWael Zoaiter
09/23/2021, 8:56 PM.
.
const elvira = new sst.NextjsSite(this, 'Elvira', {
path: 'ui/elvira',
customDomain: {
domainName: `elvira-sst-${scope.stage}.${host}`,
hostedZone: host,
},
defaultFunctionProps: {
timeout: 30,
},
environment: {
NEXT_PUBLIC_API_URL: api.cordovaUrl,
NEXT_PUBLIC_AWS_COGNITO_USER_POOL_ID: api.userPoolId,
NEXT_PUBLIC_AWS_COGNITO_CLIENT_ID: api.elviraUserPoolClientId,
NEXT_PUBLIC_AWS_COGNITO_ADMIN_USER_NAME: process.env.AWS_COGNITO_ADMIN_USER_NAME,
NEXT_PUBLIC_AWS_COGNITO_ADMIN_PASSWORD: process.env.AWS_COGNITO_ADMIN_PASSWORD,
NEXT_PUBLIC_VEHICLES_API: process.env.VEHICLES_API,
NEXT_PUBLIC_ROBOTS_TXT: process.env.ROBOTS_TXT,
NEXT_PUBLIC_CONFIGCAT_TOKEN: process.env.CONFIGCAT_TOKEN,
NEXT_PUBLIC_GOOGLE_RECAPTCHA_KEY: process.env.GOOGLE_RECAPTCHA_KEY,
NEXT_PUBLIC_STRIPE_TOKEN: process.env.STRIPE,
NEXT_PUBLIC_ELVIRA_GOOGLE_TRACKING_ID: process.env.ELVIRA_GOOGLE_TRACKING_ID,
NEXT_PUBLIC_PUBLIC_GOOGLE_TRACKING_ID: process.env.PUBLIC_GOOGLE_TRACKING_ID,
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY: process.env.GOOGLE_MAPS_API_KEY,
NEXT_PUBLIC_ENVIRONMENT: process.env.ENVIRONMENT,
NEXT_PUBLIC_GOOGLE_ANALYTICS: process.env.GOOGLE_ANALYTICS,
NEXT_PUBLIC_ALEXA_KEY: process.env.ALEXA_KEY,
NEXT_PUBLIC_PAYPAL_CLIENT_ID: process.env.PAYPAL_CLIENT_ID,
},
});
elvira.attachPermissions(sst.PermissionType.ALL);
.
.
Frank
ApiFunction
in its name;
3. open up the Configuration
tab
4. select Permissions
on the left panel
5. click on Role name link on the right, it will take you to the IAM console
6. expand on the policy, like in the screenshot.
And if you could copy and paste the permissions hereWael Zoaiter
09/23/2021, 9:08 PM{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:GetObject*",
"s3:GetBucket*",
"s3:List*",
"s3:DeleteObject*",
"s3:PutObject*",
"s3:Abort*"
],
"Resource": [
"arn:aws:s3:::dev-cordova-web-elvirabucketdce49cc2-1rbnluolf0tv6",
"arn:aws:s3:::dev-cordova-web-elvirabucketdce49cc2-1rbnluolf0tv6/*"
],
"Effect": "Allow"
},
{
"Action": [
"sqs:SendMessage",
"sqs:GetQueueAttributes",
"sqs:GetQueueUrl"
],
"Resource": "arn:aws:sqs:us-east-1:763610264561:dev-cordova-web-elvirabucketdce49cc2-1rbnluolf0tv6.fifo",
"Effect": "Allow"
},
{
"Action": "lambda:InvokeFunction",
"Resource": "arn:aws:lambda:us-east-1:763610264561:function:dev-cordova-Web-ElviraRegenerationFunction091C74EC-4HNy9O0ab4z2",
"Effect": "Allow"
},
{
"Action": "*",
"Resource": "*",
"Effect": "Allow"
}
]
}
Frank
Wael Zoaiter
09/23/2021, 9:15 PMdev-cordova-Web-ElviraApiFunctionE01E71E9-MC0BUVyFdPuh
Frank
eu-west-1
.
3. search for function name dev-cordova-Web-ElviraApiFunctionE01E71E9-MC0BUVyFdPuh
, you should see a log group called /aws/lambda/us-east-1.dev-cordova-Web-ElviraApiFunctionE01E71E9-MC0BUVyFdPuh
4. go into the log group, and select the first log stream
Do you see an error in there?Wael Zoaiter
09/23/2021, 9:27 PMWael Zoaiter
09/23/2021, 9:28 PM"UserNotFoundException: User does not exist."
Wael Zoaiter
09/23/2021, 9:30 PM503
right ?Frank
Frank
Wael Zoaiter
09/23/2021, 9:31 PMFrank