Devin
02/25/2022, 11:53 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.
So I “think” the problem is that I need to make the bucket public. But it’s not super obvious that I’m correct. I”m deploying now to test.
const staticSite = new sst.StaticSite(this, "Site", {
path: "website",
errorPage: "404.html",
buildOutput: "public",
buildCommand: "npm run build",
s3Bucket: {
accessControl: BucketAccessControl.PUBLIC_READ, // added this to make it public
},
cfDistribution: {
defaultBehavior: {
allowedMethods: ["GET"],
edgeLambdas: [
{
functionVersion: originRewriteHandler.currentVersion, // this is the edge function referenced above
eventType: LambdaEdgeEventType.ORIGIN_REQUEST,
},
],
},
},
});
Does that seem correct?
it wasn’t 😞Garret Harp
02/26/2022, 3:05 AMNoah D
02/26/2022, 3:14 AMRDS
construct and kysely
. Does anyone know how to select a record with a string like userId
in js when the column is a uuid type in postgres, currently getting the following error
ERROR: operator does not exist: uuid == character varying
Ernie Francis
02/26/2022, 3:57 AMJames
02/26/2022, 10:25 AMcustomDomain:
scope.stage === "prod" ? "<http://api.my-serverless-app.com|api.my-serverless-app.com>" : undefined,
cbeckley
02/26/2022, 2:20 PMDevin
02/26/2022, 7:12 PMFrank
Garret Harp
02/27/2022, 1:00 AMjustindra
02/27/2022, 4:40 AMkysely
with your kysely-data-api
plugin. It's pretty awesome so far, but I'm struggling to send through a point value. I'm using the PostGIS extension and one of my fields is a Point.
Here is the error I'm getting
BadRequestException: ERROR: column "location" is of type point but expression is of type character varying
Hint: You will need to rewrite or cast the expression.
I did try sending it directly through the data-api instead of using the Kysely wrapper and it seems to work with no issues. I have a feeling it's being sent as a string instead of as a point.Pablo Fernandez
02/27/2022, 5:18 PMnpm test
inside the frontend
folder, which is a React project, it works and the test pass. But when I run it in the root of my project, I get an error when running the same tests.Kristian Lake
02/27/2022, 6:04 PMMilos Glavinic
02/28/2022, 12:12 AMMichael Rooney
02/28/2022, 7:39 AMUncaught Exception {"errorType":"Error","errorMessage":"The worker thread exited","stack":["Error: The worker thread exited"," at Worker.onWorkerExit (/Users/Michael/workspace/theater-profiles/.sst/artifacts/mrooney-theatrum-profiles--core-stack-CreateProfileLambda/src/lambda/create-profile/handler.js:1785:36)"," at Worker.emit (node:events:394:28)"," at Worker.emit (node:domain:475:12)"," at Worker.[kOnExit] (node:internal/worker:281:10)"," at Worker.<computed>.onexit (node:internal/worker:201:20)"]}
/Users/Michael/workspace/theater-profiles/.sst/artifacts/mrooney-theatrum-profiles--core-stack-CreateProfileLambda/src/lambda/create-profile/handler.js:1871
throw new Error("the worker has exited");
^
Error: the worker has exited
at ThreadStream.flushSync (/Users/Michael/workspace/theater-profiles/.sst/artifacts/mrooney-theatrum-profiles--core-stack-CreateProfileLambda/src/lambda/create-profile/handler.js:1871:17)
at process.onExit2 (/Users/Michael/workspace/theater-profiles/.sst/artifacts/mrooney-theatrum-profiles--core-stack-CreateProfileLambda/src/lambda/create-profile/handler.js:2084:16)
at process.emit (node:events:406:35)
at process.emit (node:domain:475:12)
at process.exit (node:internal/process/per_thread:184:15)
at process.<anonymous> (file:///Users/Michael/workspace/theater-profiles/node_modules/@serverless-stack/aws-lambda-ric/lib/index.js:31:17)
at process.emit (node:events:394:28)
at process.emit (node:domain:475:12)
at process._fatalException (node:internal/process/execution:170:25)
Albert
02/28/2022, 3:31 PMJack Tan
02/28/2022, 10:52 PM/aws/lambda/dev-papermind-signature-s-SignatureApisLambdaGETsi-28GoENFjgrhK
, whereas I like it to be /aws/lambda/dev-papermind-signature-service-{nameOfApi}
I have "name": "papermind-signature-service"
in sst.json
, but I guess the name is too long... hence the cut off at papermind-signature-s
SignatureApis
is from new Api(this, "SignatureApis"
, how do I get rid of this LambdaGETsi-28Go....
Jan Plaček
03/01/2022, 8:53 AM"GET /dist": {
function: {
bundle: false,
srcPath: "../../dist/apps/lambda/",
handler: "index.handler",
},
authorizationType: sst.ApiAuthorizationType.NONE,
}
results in
127e794d-009b-4136-b06e-dda7d1f2c97a REQUEST jplacek-sst-my-stack-ApiLambdaGETdist77255DFF-QTX6rp9SQ4te [index.handler] invoked by API GET /dist
X [ERROR] Cannot use "external" without "bundle"
127e794d-009b-4136-b06e-dda7d1f2c97a ERROR build_failure: The function index.handler failed to build
Manuel Villafañe
03/01/2022, 12:33 PMJędrzej Kuryło
03/01/2022, 3:49 PMTim V
03/01/2022, 5:21 PMThe Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions.
Here's my setup...
const viewerRequest = new Function(this, "viewer-request", {
handler: "stack/cloudfront/viewer-request.handler",
memorySize: 128,
timeout: 5,
// permissions: [
// new PolicyStatement({
// effect: Effect.ALLOW,
// actions: ["lambda:InvokeFunction"],
// resources: [viewerRequestHandler.functionArn],
// }),
// ],
});
viewerRequest.node.host.environment = {};
viewerRequest.node.host.role.assumeRolePolicy.statements = [
new PolicyStatement({
effect: Effect.ALLOW,
actions: ["sts:AssumeRole"],
principals: [
new ServicePrincipal("<http://lambda.amazonaws.com|lambda.amazonaws.com>"),
new ServicePrincipal("<http://edgelambda.amazonaws.com|edgelambda.amazonaws.com>"),
],
})
];
const site = new StaticSite(this, "website", {
path: "stack/website",
buildOutput: "dist",
buildCommand: "yarn build",
environment: { API_ENDPOINT: api.url },
disablePlaceholder: true,
cfDistribution: {
priceClass: PriceClass.PRICE_CLASS_100,
defaultBehavior: {
allowedMethods: ["GET"],
edgeLambdas: [{
eventType: LambdaEdgeEventType.VIEWER_REQUEST,
functionVersion: viewerRequest.currentVersion,
}],
},
// additionalBehaviors: {
// "/files": {
// origin: new S3Origin(bucket.s3Bucket),
// allowedMethods: ["GET"],
// edgeLambdas: [{
// eventType: LambdaEdgeEventType.VIEWER_REQUEST,
// functionVersion: viewerRequest.currentVersion,
// }],
// },
// },
},
});
Daniel da Rocha
03/01/2022, 5:47 PMcannot find module puppeteer/lib/Browser
Not sure what else to try. Here is my GH repo if anyone could to take a look? 🙏
https://github.com/danrocha/amazon-book-pageGarret Harp
03/01/2022, 6:33 PMRoss Gerbasi
03/01/2022, 10:48 PMViteStaticSite
when running sst start
and a stack change happens? Anytime I save a stack file it does Stacks: Synthesizing changes..
then ends up rebuilding the site. I would think in local dev mode there isn't much use for a vite build?Michael James Munar
03/02/2022, 10:48 AMnpx sst start
^ when I run this, everything works fine, but on deployment I keep getting this error which I couldn't find how to fix
Error: There was a problem transpiling the Lambda handler: > node_modules/pg/lib/native/client.js:4:21: error: Could not resolve "pg-native" (mark it as external to exclude it from the bundle, or surround it with try/catch to handle the failure at run-time)
4 │ var Native = require('pg-native')
╵ ~~~~~~~~~~~
at Object.bundle (/tmp/seed/source/node_modules/@serverless-stack/core/dist/runtime/handler/node.js:226:23)
at Object.bundle (/tmp/seed/source/node_modules/@serverless-stack/core/dist/runtime/handler/handler.js:19:16)
at new Function (/tmp/seed/source/node_modules/@serverless-stack/resources/src/Function.ts:362:39)
at Function.fromDefinition (/tmp/seed/source/node_modules/@serverless-stack/resources/src/Function.ts:514:14)
at Api.createFunctionIntegration (/tmp/seed/source/node_modules/@serverless-stack/resources/src/Api.ts:579:23)
at Api.addRoute (/tmp/seed/source/node_modules/@serverless-stack/resources/src/Api.ts:466:26)
at /tmp/seed/source/node_modules/@serverless-stack/resources/src/Api.ts:303:12
at Array.forEach (<anonymous>)
at Api.addRoutes (/tmp/seed/source/node_modules/@serverless-stack/resources/src/Api.ts:302:25)
at new Api (/tmp/seed/source/node_modules/@serverless-stack/resources/src/Api.ts:272:10)
There was an error synthesizing your app.
Anybody knowledgeable on bundling, please enlighten me
Edit: the package I added is pg-promise
-> https://github.com/vitaly-t/pg-promiseJamie Berke
03/02/2022, 1:36 PM0.66.3
and I am getting the following error at runtime
Cannot use import statement outside a module
(node:65576) Warning: require() of ES modules is not supported.
require() of /Users/jamieberke/Documents/GitHub/dentr/backend/node_modules/@serverless-stack/aws-lambda-ric/bin/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/jamieberke/Documents/GitHub/dentr/backend/node_modules/@serverless-stack/aws-lambda-ric/package.json.
Sulaiman Baig
03/02/2022, 3:53 PMChris
03/02/2022, 6:27 PMimport mailchimp from "@mailchimp/mailchimp_marketing";
When I run the lambda on AWS I get the following error:
"errorType": "TypeError",
"errorMessage": "Cannot set property 'setConfig' of undefined",
"stack": [
"TypeError: Cannot set property 'setConfig' of undefined",
" at /var/task/src/test.js:7:245570",
" at /var/task/src/test.js:1:249",
" at /var/task/src/test.js:7:249760",
" at /var/task/src/test.js:1:249",
" at Object.<anonymous> (/var/task/src/test.js:7:249825)",
" at Module._compile (internal/modules/cjs/loader.js:1085:14)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)",
" at Module.load (internal/modules/cjs/loader.js:950:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:790:12)",
" at Module.require (internal/modules/cjs/loader.js:974:19)"
]
The line that fails is not in my own function code, but the included mailchimp source that's transpiled into the lambda at the top. Other node modules I'm using work fine. Is this an issue with the mailchimp module or some bug in the transpile? Again, it all works fine during live development.
I'm running version 0.66.3
Thanks for any help!John
03/02/2022, 9:25 PMNir Weiner
03/02/2022, 11:52 PMnpx sst start
, and make a change to MyStack.ts - nothing is redeployed.
I guess it is not tracking changes in the stack.
Any workaround beside restarting sst?Aman Saran
03/03/2022, 12:52 AM