Adrian Schweizer
12/27/2021, 9:25 PMDevin
12/28/2021, 12:09 AMpk: SID#${messageid} | sk: SID#${messageid} | messageStatus | gsipk
Then twilio hits a callback with the SID# where I update the status. The front end polls against the gsipk
Once the msssageStatus
is delivered or failed
you can resend. This works pretty great 🎉. But I’m now storing each message in the database. Which is not needed. So, after creating a message, I’m just deleting the old message.
await dynamoDb.put(params);
if (shouldDeleteOldMessage) {
const existingItem = {
TableName: process.env.TABLE_NAME,
Key: {
pk: existingPk,
sk: existingPk,
},
};
await dynamoDb.delete(existingItem);
}
Seems bad to make the front end wait until after I delete the item (or worse fail because that operation fails.
I have some alternative thoughts but I’m curious what you’d do?Sam Hulick
12/28/2021, 7:16 AM.sst/artifacts
now, maybe.Something went wrong installing the "sharp" module
Cannot find module '../build/Release/sharp-darwin-x64.node'
Require stack:
- /Volumes/SuperData/Sites/reelcrafter/v2-microservices/.sst/artifacts/9ed24b68/src/lambda/rest/functions/update-media.js
- /Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/aws-lambda-ric/lib/utils/UserFunction.js
- /Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/aws-lambda-ric/lib/index.js
- /Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/aws-lambda-ric/bin/index.js
but the .node
file it’s looking for totally exists in node_modules/sharp
. Mischa Spiegelmock
12/28/2021, 3:09 PMsrcPath
? Anything I can do about this?
Error: Cannot find module 'search'
Sam Hulick
12/28/2021, 8:01 PMjustindra
12/28/2021, 11:58 PMsst build
the type-checking is type checking @types/react
in my node_modules
The setup is using Yarn Workspaces monorepo
(root)
+ infra
+ cdk (this is where SST is)
+ apps
+ admin (a react app)
+ web (another react app)
Any thoughts?chittasec
12/29/2021, 2:16 AMmathewgries
12/29/2021, 2:11 PMMischa Spiegelmock
12/29/2021, 2:18 PMReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/Users/cyber/dev/platform/packages/infra/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at file:///Users/cyber/dev/platform/packages/infra/.sst/artifacts/1d3e06ae/builder.js:2:25
at ModuleJob.run (internal/modules/esm/module_job.js:170:25)
at async Loader.import (internal/modules/esm/loader.js:178:24)
at async Object.loadESM (internal/process/esm_loader.js:68:5)
at Object.bundle (/Users/cyber/dev/serverless-stack/packages/core/dist/runtime/handler/node.js:198:23)
at Object.bundle (/Users/cyber/dev/serverless-stack/packages/core/dist/runtime/handler/handler.js:19:16)
at new Function (/Users/cyber/dev/serverless-stack/packages/resources/src/Function.ts:359:39)
at Function.fromDefinition (/Users/cyber/dev/serverless-stack/packages/resources/src/Function.ts:528:14)
at PlatformApi.addResolver (/Users/cyber/dev/serverless-stack/packages/resources/src/AppSyncApi.ts:376:19)
at /Users/cyber/dev/serverless-stack/packages/resources/src/AppSyncApi.ts:203:23
at Array.forEach (<anonymous>)
at PlatformApi.addResolvers (/Users/cyber/dev/serverless-stack/packages/resources/src/AppSyncApi.ts:201:28)
at new VacancyService (/Users/cyber/dev/platform/packages/infra/lib/service/vacancy.ts:23:13)
at new ApiServices (/Users/cyber/dev/platform/packages/infra/lib/service/apiServices.ts:68:5)
Ryan Martin
12/29/2021, 2:44 PMipsherman
12/29/2021, 3:01 PMnpm install aws-amplify
, noticeably not npm install aws-amplify --save
. Is there a reason why this step doesn't --save
? Thanks!Ryan Martin
12/29/2021, 4:29 PMFederico Miras
12/29/2021, 6:42 PMRoss Gerbasi
12/30/2021, 12:01 AMauthorizationType
I am setting authorizer
for two different endpoints. When I do a build I notice the authorizers are not in the JSON template at all. I only seem to be able to get one authorizer to show up and that's when I use defaultAuthorizer
on the whole gateway. Am I missing something dumb?Maged Mortaga
12/30/2021, 3:31 AMJohn Kor
12/30/2021, 6:38 AMRuntime.ImportModuleError
error. i have a simple sqs queue with a lambda fn attached as a consumer. ive added mysql2
and knex
as layers. the specific error is that the module knex
cannot be found during runtime. any advice on how to debug this issue? thanks in advance!Mischa Spiegelmock
12/31/2021, 9:27 AMsrcPath
? Anything I can do about this?
Error: Cannot find module 'search'
gio
12/31/2021, 9:29 AMJoshua Oransky
12/31/2021, 2:28 PMpath
was not defined initially, it cannot be defined later... Instead, you'd need to remove the customDomain
option from the construct, deploy it." I've tried this and it doesn't seem to add it. Is there something specific that needs to happen to be able to add a path to a custom domain when it wasn't defined previously?Sam Hulick
12/31/2021, 7:02 PMApi
construct to specify a wildcard for a route? e.g. GET /something/*
? I need the route to match /something/123abc
as well as /something/hi/hello
. does GET /something/{proxy+}
work?Sam Hulick
01/01/2022, 12:31 AMJacob Hogenkamp
01/01/2022, 6:25 PMsls invoke local -f <handler> -d '<event>'
Is it better to use a local invokation with SAM or is there a way to leverage the live-lambda environment?
My use case is to iteratively rerun a S3 upload notification event when an image processing handler fails and needs debugging.Garret Harp
01/02/2022, 8:58 PMCarlos Daniel
01/03/2022, 2:46 AMindex.js
of my application. I have an app called copy-ddb-table, and I was creating a stack called stack on it, so the full name of my stack (when running locally) was supposed to be something like local-copy-ddb-table-stack
, right? But what had happened was, when I passed the property stackName to my stack (line 11), it actually has changed the whole stack name. So instead of having a stack called local-copy-ddb-table-stack
, I was having a stack called local-copy-ddb-table
because is the string generated from my template string.
And the bug is, since the stack name generated by the app was different than the stack name on the props, I received an error when running the sst start
(screenshot 2).Garret Harp
01/03/2022, 4:44 AM{
"version": "2018-05-29",
"operation": "Query",
"query": {
"expression": "#PK = :userId and begins_with(#SK, :noteItem)",
"expressionNames": {
"#PK": "PK",
"#SK": "SK"
},
"expressionValues": {
":userId": $util.dynamodb.toDynamoDBJson("USER#$ctx.args.userId"),
":noteItem": $util.dynamodb.toDynamoDBJson("NOTE#")
},
"limit": $util.toJson($util.defaultIfNull($ctx.args.limit, 20))
#if($ctx.args.nextToken)
, "nextToken": $util.toJson($ctx.args.nextToken)
#end
}
}
Derek Kershner
01/03/2022, 4:46 PMlambda.Function.fromFunctionAttributes(
this,
"EventsPublisherFunction",
{
functionArn: ssm.StringParameter.valueForStringParameter(
this,
RESONANCE_EVENTS_PUBLISHER_FUNCTION_ARN_SSM_PARAM
),
role: iam.Role.fromRoleArn(
this,
"EventsPublisherFunctionRole",
ssm.StringParameter.valueForStringParameter(
this,
RESONANCE_EVENTS_PUBLISHER_FUNCTION_ROLE_ARN_SSM_PARAM
)
),
}
);
A sample grant:
distributionDynamoDlq.grantSendMessages(this.eventsPublisherFunction);
this.distributionDynamoTable.grantStreamRead(
this.eventsPublisherFunction
);
The issue is that only the LAST stack deployed sticks, as in it overwrites the other stacks permissions, and only grants eventsPublisherFunction
its resources. Is this expected behavior?Seth Geoghegan
01/03/2022, 5:59 PMonCreate
and removes a database onDelete
. I've tested by putting the lambda behind the sst.API construct and it works fine.
However, when I define the sst.Script construct with the same lambda, sst start
and sst remove
take very long (20+ minutes). Without the Script construct, these actions take around 1-2 minutes to deploy from scratch.
Any tips to debug this, or is this the expected behavior with custom resources?Mischa Spiegelmock
01/03/2022, 7:22 PMsst build
in my CI build/test action, but I get this error:
[Error at /none-platform-tombo] Need to perform AWS calls for account my-account, but no credentials have been configured
Found errors
There was an error synthesizing your app.
npm ERR! Lifecycle script `build` failed with error:
npm ERR! Error: command failed
npm ERR! in workspace: platform-infra@0.1.0
npm ERR! at location: /home/runner/work/platform/platform/packages/infra
Mischa Spiegelmock
01/03/2022, 7:23 PMSam Hulick
01/03/2022, 8:41 PM