Kevin Grimm
05/24/2022, 11:21 PM503 ERROR
The request could not be satisfied.
The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
Generated by cloudfront (CloudFront)
Request ID: <Request_ID>
Couple notes/observations as I continue to investigate this:
• The most suspect change I can think of are updates to the CSP policy to accept traffic from Google Analytics. Adding the code below for reference.
• I saw from several past threads that this could be a Next JS issue. Could also be a me issue as I have overlooked stuff in the past (and will again 😃 )
// next.config.js
const ContentSecurityPolicy = `
default-src
'self';
script-src
<https://www.googletagmanager.com/>
'self'
'unsafe-eval'
'unsafe-inline';
style-src
'self'
'unsafe-inline';
img-src
*
blob:
data:;
media-src
'none';
connect-src
*;
font-src
'self';
frame-src
'none';
`;
const securityHeaders = [
// <https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP>
{
key: "Content-Security-Policy",
value: ContentSecurityPolicy.replace(/\n/g, ""),
},
// ... other headers
];
I'm also exploring the CNAMEs associated with my hosted zone... seems like the # has increased since the last deployment. What's also curious is that I've identified two separate ACM certificates with the same underlying CNAME (also referencing the same domain). That strikes me as odd so may just rm -rf
the stack and see if an infrastructure reset solves the issue. If that's the case though I'll likely do additional research into past npx sst deploy
commands since I'm not generating any manual infraKevin Grimm
05/24/2022, 11:25 PMNextjsSite
construct... and that just seems like a recipe for a bad time.
const site = new sst.NextjsSite(this, "MySite", {
path: "frontend",
customDomain: {
domainName:
scope.stage === "prod" ? "<http://websiteName.io|websiteName.io>" : `${scope.stage}.<http://websiteName.io|websiteName.io>`,
domainAlias: scope.stage === "prod" ? "<http://www.websiteName.io|www.websiteName.io>" : undefined,
cdk: {
certificate: Certificate.fromCertificateArn(
this,
"WebsiteCert",
process.env.WEBSITE_CERT_ARN
),
},
hostedZone: HostedZone.fromHostedZoneAttributes(this, "WebsiteZone", {
hostedZoneId: process.env.HOSTED_ZONE_ID,
zoneName: process.env.ZONE_NAME,
}),
},
});
Kevin Grimm
05/24/2022, 11:30 PMDerek Kershner
05/25/2022, 2:42 AMDerek Kershner
05/25/2022, 2:43 AMKevin Grimm
05/25/2022, 2:48 AMDerek Kershner
05/25/2022, 2:50 AMus-east-1
.Derek Kershner
05/25/2022, 2:51 AMDerek Kershner
05/25/2022, 2:51 AMKevin Grimm
05/25/2022, 2:54 AMKevin Grimm
05/25/2022, 2:55 AMDerek Kershner
05/25/2022, 2:57 AMKevin Grimm
05/25/2022, 2:58 AMKevin Grimm
05/25/2022, 4:25 AMKevin Grimm
05/25/2022, 1:07 PMDerek Kershner
05/25/2022, 1:56 PMFrank
Kevin Grimm
05/25/2022, 11:27 PMI still think it is a legitimate permissions issue, it almost always is.
very true, "it's a permission issue" is relatedly a safe bet on the AWS examsKevin Grimm
05/25/2022, 11:28 PMKevin Grimm
05/25/2022, 11:50 PM{
"errorType": "SyntaxError",
"errorMessage": "Unexpected token '.'",
"stack": [
"/var/task/chunks/647.js:66",
" window.gtag?.(\"event\", action, {",
" ^",
"",
"SyntaxError: Unexpected token '.'",
" at wrapSafe (internal/modules/cjs/loader.js:915:16)",
" at Module._compile (internal/modules/cjs/loader.js:963:27)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)",
" at Module.load (internal/modules/cjs/loader.js:863:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:708:14)",
" at Module.require (internal/modules/cjs/loader.js:887:19)",
" at require (internal/modules/cjs/helpers.js:74:18)",
" at Object.__webpack_require__.f.require (/var/task/webpack-runtime.js:162:28)",
" at /var/task/webpack-runtime.js:73:40",
" at Array.reduce (<anonymous>)"
]
}
Kevin Grimm
05/26/2022, 12:25 AM