Adrián Mouly
12/20/2021, 11:30 PM@types/mycompany
and put it as a devDependency
on both projects.
2. Put the backend project as a devDependency
of the frontend project.
3. Use an “API client generator” like swagger/OpenApi or something similar that can auto-generate types. I don’t know much how to share the types here yet, but it’s a theory.
4. Use a mono-repo strategy… I don’t like this due my company already uses separated repos for each app.
What should I do? anybody else doing any of these?Erik Robertson
12/21/2021, 10:06 AMBucket named 'cdk-hnb659fds-assets-055101xxxxxx-us-west-2' exists, but not in account 055101xxxxxx. Wrong account?
I've replaced the last 6 digits with x in the paste above but they were exactly the same. Any idea ?
I've tried enlarging my S3 perms to * resources (I had 'cdk-*' before) but no difference.
Should I just try manually deleting the bucket and see if that helps ?
In my existing buckets there is also the same bucket but with us-east-1 in the end.Simon Reilly
12/21/2021, 12:25 PMRichard Simpson
12/21/2021, 6:49 PM<http://api-x.company.com|api-x.company.com> -> /
<http://api-y.company.com|api-y.company.com> -> /
?Tonny (sstNerd)
12/21/2021, 7:51 PMErik Robertson
12/21/2021, 9:24 PMa625b40c-04d9-4cbe-90b7-8324e904055a REQUEST DEV-ERIK-dwam-back-my-sta-ApiLambdaGETassets0D68A0-FzosTE9J9tP7 [src/routes/assets_get.main] invoked by API GET /assets
a625b40c-04d9-4cbe-90b7-8324e904055a RESPONSE {"headers":{"Content-Type":"application/json"},"statusCode":200,"body":"{\n \"csvHeader\": \"latitude,longitude\",\n \"csvData\": \"37.65728378,-122.4156265\\r\\n37.65734863,-122.41... 177051 more characters"}
Failed to upload payload to S3. AccessDenied: Access Denied
at Request.extractError (/Users/erik/src/dataworks/dwam-back/node_modules/aws-sdk/lib/services/s3.js:714:35)
at Request.callListeners (/Users/erik/src/dataworks/dwam-back/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/Users/erik/src/dataworks/dwam-back/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/Users/erik/src/dataworks/dwam-back/node_modules/aws-sdk/lib/request.js:688:14)
at Request.transition (/Users/erik/src/dataworks/dwam-back/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/Users/erik/src/dataworks/dwam-back/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /Users/erik/src/dataworks/dwam-back/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/Users/erik/src/dataworks/dwam-back/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/Users/erik/src/dataworks/dwam-back/node_modules/aws-sdk/lib/request.js:690:12)
at Request.callListeners (/Users/erik/src/dataworks/dwam-back/node_modules/aws-sdk/lib/sequential_executor.js:116:18) {
code: 'AccessDenied',
region: null,
time: 2021-12-21T21:20:09.867Z,
requestId: 'R0H1MF37YG9JSGTQ',
extendedRequestId: 'SXswySS3eGF3DkYb/YjNO8YIw2T911TZViSQZbivYh6VHH71nfQP33L1lTVTA6oixDM5oFvwEuc=',
cfId: undefined,
statusCode: 403,
retryable: false,
retryDelay: 43.50154802428319
}
and when I check the Cloudwatch logs I see this 404 on S3 :
2021-12-21T22:20:05.498+01:00 START RequestId: a625b40c-04d9-4cbe-90b7-8324e904055a Version: $LATEST
2021-12-21T22:20:05.517+01:00 2021-12-21T21:20:05.516Z a625b40c-04d9-4cbe-90b7-8324e904055a INFO connectAndSendMessage()
2021-12-21T22:20:05.641+01:00 2021-12-21T21:20:05.641Z a625b40c-04d9-4cbe-90b7-8324e904055a INFO ws.onopen
2021-12-21T22:20:05.641+01:00 2021-12-21T21:20:05.641Z a625b40c-04d9-4cbe-90b7-8324e904055a INFO sendMessage() - send request
2021-12-21T22:20:05.643+01:00 2021-12-21T21:20:05.642Z a625b40c-04d9-4cbe-90b7-8324e904055a INFO sendMessage() - sending request via WebSocket
2021-12-21T22:20:05.644+01:00 2021-12-21T21:20:05.643Z a625b40c-04d9-4cbe-90b7-8324e904055a INFO sendMessage() - start keep alive timer
2021-12-21T22:20:10.189+01:00 2021-12-21T21:20:10.188Z a625b40c-04d9-4cbe-90b7-8324e904055a INFO ws.onmessage {"action":"client.lambdaResponse","debugRequestId":"a625b40c-04d9-4cbe-90b7-8324e904055a-1640121605516","stubConnectionId":"Kt-45fnPPHcCGBQ=","payloadS3Key":"payloads/a625b40c-04d9-4cbe-90b7-8324e904055a-1640121605516-response"}
2021-12-21T22:20:10.189+01:00 2021-12-21T21:20:10.189Z a625b40c-04d9-4cbe-90b7-8324e904055a INFO receiveMessage()
2021-12-21T22:20:10.189+01:00 2021-12-21T21:20:10.189Z a625b40c-04d9-4cbe-90b7-8324e904055a INFO receiveMessage() - received payloadS3Key
2021-12-21T22:20:10.256+01:00 2021-12-21T21:20:10.256Z a625b40c-04d9-4cbe-90b7-8324e904055a INFO [AWS s3 404 0.065s 0 retries] getObject({ Bucket: 'dev-erik-dwam-back-debug-stack-bucket83908e77-1awrh01i15tnq', Key: 'payloads/a625b40c-04d9-4cbe-90b7-8324e904055a-1640121605516-response' })
2021-12-21T22:20:10.259+01:00 2021-12-21T21:20:10.259Z a625b40c-04d9-4cbe-90b7-8324e904055a ERROR Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"NoSuchKey: The specified key does not exist.","reason":{"errorType":"NoSuchKey","errorMessage":"The specified key does not exist.","code":"NoSuchKey","message":"The specified key does not exist.","region":null,"time":"2021-12-21T21:20:10.253Z","requestId":"0G7QZ64M4EVDDPV5","extendedRequestId":"Zk5DMRznR+DMrIMUD0jYqUlGn2aejxk6E+Gl0WupDfZCynNyUKOzjWUJPK10Pseeu80tzGB6t4o=","statusCode":404,"retryable":false,"retryDelay":8.646154170322662,"stack":["NoSuchKey: The specified key does not exist."," at Request.extractError (/var/runtime/node_modules/aws-sdk/lib/services/s3.js:699:35)"," at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:106:20)"," at Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:78:10)"," at Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:688:14)"," at Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)"," at AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)"," at /var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10"," at Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:38:9)"," at Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:690:12)"," at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:116:18)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: NoSuchKey: The specified key does not exist."," at process.<anonymous> (/var/runtime/index.js:35:15)"," at process.emit (events.js:314:20)"," at process.EventEmitter.emit (domain.js:483:12)"," at processPromiseRejections (internal/process/promises.js:209:33)"," at processTicksAndRejections (internal/process/task_queues.js:98:32)"]}
2021-12-21T22:20:10.275+01:00 END RequestId: a625b40c-04d9-4cbe-90b7-8324e904055a
2021-12-21T22:20:10.275+01:00 REPORT RequestId: a625b40c-04d9-4cbe-90b7-8324e904055a Duration: 4775.65 ms Billed Duration: 4776 ms Memory Size: 1024 MB Max Memory Used: 28 MB XRAY TraceId: 1-61c24505-337b01bf10f9f70f44866cac SegmentId: 247605f67fd8dd26 Sampled: true
2021-12-21T22:20:10.275+01:00 Unknown application error occurred
I'm eager to see if any of you have any idea ?João Pedro
12/21/2021, 9:27 PMCannot perform specific action because there does not exist a valid use pool domain associated with the user pool
How do I set a domain+name on the Auth
construct? Couldn’t find it on the userPool or userPoolClient propsJędrzej Kuryło
12/21/2021, 9:38 PMsst build
, then sst deploy
, but I see no changes
in the output and end up having old version of my lambdas in AWS. Is there a step that I'm missing? The only way I've found so far to "refresh" the lambda code is to remove a route, redeploy, add the route back and deploy again. I assumed that lambda code will get uploaded when I deploy even if there are no changes to the stack configuration, but it doesn't seem to be the caseBshr Ramadan
12/21/2021, 10:10 PMAppSyncApi
? or it's not supportedJared Burke
12/21/2021, 11:07 PMsst start
. I'm using sst.ApolloApi
, essentially the exact example here.
The response from my lambda is a 404
, and when attempting to load the endpoint in browser, I get: Cannot GET /
Any hints?Devin
12/22/2021, 1:49 PMconst customersTable = new sst.Table(this, "Customers", {
fields: {
pk: sst.TableFieldType.STRING,
sk: sst.TableFieldType.STRING,
},
primaryIndex: { partitionKey: "pk", sortKey: "sk" },
});
What I want is to make, createdAt
a secondary primary key so that I can fulfill the access pattern of getCustomerByCreatedAt
It seems like this is the correct way to do this but I”m not sure.
customersTable.addGlobalIndexes({
indexName: "createdAt",
partitionKey: { name: "gs1pk", type: sst.TableFieldType.STRING },
});
Gerald
12/22/2021, 2:47 PMSam Hulick
12/22/2021, 5:50 PM${Token[TOKEN.1210]}
. is there some way to evaluate those?
or, really, I’m just trying to figure out the output of api.url
(sst.Api
).David Garcia
12/22/2021, 6:59 PMDevin
12/22/2021, 9:09 PMCarlos Daniel
12/22/2021, 10:06 PMDillon Peterson
12/22/2021, 10:09 PMDevin
12/22/2021, 10:24 PMgsi1
and so on?Mehmet Ali SARAÇ
12/22/2021, 11:47 PMsst start --stage local
but code changes not updating. Live reload not working ? I dont see any errors ? how should I debug this ?Jack G
12/23/2021, 3:36 PMGjorgji Kjosev
12/23/2021, 4:14 PMprocess.env
? Based on reading these docs (https://serverless-stack.com/examples/how-to-create-a-crud-api-with-serverless-using-dynamodb.html) it seems like they should be, however I'm getting undefined
valuesDevin
12/23/2021, 10:00 PMapi.url
to the functions in one pass?
this.api = new sst.Api(this, "Api", {
defaultAuthorizationType: "AWS_IAM",
defaultFunctionProps: {
environment: {
API_URL: this.api.url, // like here
I want to have access to it in a route.
I suppose I can do it just by using addRoutes
?Gjorgji Kjosev
12/24/2021, 12:09 AMsst.ReactStaticSite
allow environment variables to be passed to the frontend app? Does it depend on a particular setup for production deployment? (i.e. availability of scripts, webpack env variable / define plugin, etcJett Robin Andres
12/24/2021, 2:27 AM@aws-cdk/aws-secretsmanager
? I need help retrieving my generated secret to format it with postgres url and pass it on as an environment variable to my fargate service.
I have the ff code:
import { Secret } from '@aws-cdk/aws-secretsmanager'
const dbCredentials = new Secret(this, 'DBCredentialsSecret', {
secretName: 'my-db-credentials',
generateSecretString: {
secretStringTemplate: JSON.stringify({
username,
}),
excludePunctuation: true,
includeSpace: false,
generateStringKey: 'password',
},
})
I’ve tried outputting the ff syntaxes:
dbCredentials.secretValueFromJson('password').toString()
ECSecret.fromSecretsManager(passwordSecret, 'password')
but they only show me the gibberish value (or something similar):
{{resolve:secretsmanager:arn:aws:secretsmanager:us-east-2:732453962214:secret:my-db-credentials-c3Qjjv:SecretString:password::}}
Ross Coundon
12/24/2021, 7:34 AMconst kmsKey = Key.fromKeyArn(this, 'kmsKey', process.env.KMS_KEY_ARN);
const someParam = ssm.StringParameter.fromSecureStringParameterAttributes(this, 'theParam', {
parameterName: process.env.THE_PARAM_PATH,
encryptionKey: kmsKey,
version: parseInt(process.env.THE_PARAM_VERSION),
});
// define some functions
kmsKey.grantDecrypt(theFunction);
fsmCredsParam.grantRead(theFunction);
(In actual fact, rather than storing the version in a separate env var, we store it like /some/path/to/param:2 and split it around the colon.)
However, the problem with this is that the developer needs to update the env vars each time the parameter is changed to reflect the new parameter version which is a manual step that can (and does) get forgotten. The version is mandatory and you can't specify a wildcard.
Is there a slicker way of doing this?Haider Abbas
12/24/2021, 9:59 AMchittasec
12/25/2021, 2:31 PMChris Visser
12/26/2021, 8:35 PM/app/
/app/package.json
/app/lambda.js
/bff/
/bff/package.json
/bff/lambda.js
/stacks/
/stacks/AppStack.js
/stacks/BFFStack.js
/stacks/index.js // Would deploy both stacks
package.json // Contains SST
sst.json
So essentially the 2 services are "unaware" of SST, they just know about the lambda function.
Besides the "how to set this up". Would there be reasons not to do it like this? Why have SST in each service? Its quite a common practice to have the deploy mechanisms outside of each service. What am I missing here?Devin
12/26/2021, 8:46 PMcustomersTable.addGlobalIndexes({
gsi1pk: {
partitionKey: "gsi1pk",
type: sst.TableFieldType.STRING,
},
});
I can see it in my Indexes so that appears to have worked.
When I add params to put like so…
const params = {
TableName: process.env.TABLE_NAME,
Item: {
pk: `SHOP#${shop}PHONE#${phoneNumber}`,
sk: `SID#${messageSid}`,
gsi1pk: `SID#${messageSid}`,
messageStatus,
},
};
await dynamoDb.put(params);
the item is inserted in the table and I can see it 🎉
However, when I try to update that value
const values = {
TableName: process.env.TABLE_NAME,
Key: {
gsi1pk: `SID#${messageSid}`,
sk: `SID#${messageSid}`,
},
UpdateExpression: "SET messageStatus = :messageStatus",
ExpressionAttributeValues: {
":messageStatus": smsStatus,
},
};
await dynamoDb.update(values);
It’s not obvious to me what’s wrong.Noah D
12/27/2021, 12:25 AMuserVerification
• And does anyone know how to get the emails sent from my own domain (i.e. hello@mydomain.com)? Which is also hosted in aws. I have tried a solution i found online which involved using SES but didn't work as my infra is hosted in ap-southeast-2. So open to any ideas on this one 🙂
Cheers