Carlos Thurber
06/18/2022, 2:03 PMScript
construct 🙂
I have a Script
in one of my stacks, and when deploying (or working locally) I always see it updating like
dev-homes-app-system-configuration | UPDATE_IN_PROGRESS | Custom::SSTScript | ScriptsScriptResource45A648A2
dev-homes-app-system-configuration | UPDATE_COMPLETE | Custom::SSTScript | ScriptsScriptResource45A648A2
This happens even when there are no changes to this script or to that stack.
Is this normal for Scripts? or should I look more deeply for the cause?Karolis Stulgys
06/18/2022, 2:30 PMInstall the @sls-next/lambda-at-edge package by running the following in the project root.
sst project root or /frontend project root? This dep also does not exist in example repo:
https://serverless-stack.com/examples/how-to-create-a-nextjs-app-with-serverless.htmlJon Holman
06/18/2022, 3:06 PMAndrew Brown
06/18/2022, 4:16 PMSlackbot
06/18/2022, 5:34 PMKevin Procopio
06/18/2022, 7:52 PMDeploying stacks
Error: ENOENT: no such file or directory, uv_cwd
at process.wrappedCwd (node:internal/bootstrap/switches/does_own_process_state:126:28)
...
It occurs whenever I make a change to any code. I'm running sst in WSL on Windows, using VSCode. If I restart my machine it will let me do a deployment, but as soon as I make a new edit to the lambda.py code (either via vim or VSCode), the error recurs. Any idea why this is the case?Slackbot
06/18/2022, 8:54 PMDerek Kershner
06/18/2022, 10:27 PMError [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/derekkershner/repos/resonance-infrastructure-foundations/node_modules/@serverless-stack/resources/package.json
This time removing peerDependencies from the lib that builds on SST didnt work. Version 1.2.25
.
Original time I got error: https://serverless-stack.slack.com/archives/C01JG3B20RY/p1653704371418879Jon Holman
06/19/2022, 1:07 AMPaul Stone
06/19/2022, 5:58 AMRoss Gerbasi
06/19/2022, 4:34 PMaws-cdk-lib
versions. Is there a reason this is needed? I'll add more details in the thread.Kabo Mekgwe
06/20/2022, 9:57 AMSakar
06/20/2022, 10:43 AMimport { Api } from "@serverless-stack-slack/resources";
import * as dynamodb from "aws-cdk-lib/aws-dynamodb";
const table = new dynamodb.Table(this, "Table", {
dynamodbTable: dynamodb.Table.fromTableArn(
this,
"ec.subscriptions",
"arn:aws:dynamodb:ap-south-1:146331168322:table/ec.subscriptions"
),
});
Error:
TypeError: Cannot destructure property 'name' of 'attribute' as it is undefined.
at Table.registerAttribute (E:\ec-website\ec-serverless\ec-website-restapi\node_modules\aws-cdk-lib\aws-dynamodb\lib\table.js:1:22253)
at Table.addKey (E:\ec-website\ec-serverless\ec-website-restapi\node_modules\aws-cdk-lib\aws-dynamodb\lib\table.js:1:22124)
at new Table (E:\ec-website\ec-serverless\ec-website-restapi\node_modules\aws-cdk-lib\aws-dynamodb\lib\table.js:1:11506)
at EmptyStack.MyStack (file:///E:/ec-website/ec-serverless/ec-website-restapi/.build/lib/index.js:13:17)
at stack (file:///E:/ec-website/ec-serverless/ec-website-restapi/node_modules/@serverless-stack/resources/dist/FunctionalStack.js:15:35)
at App.stack (file:///E:/ec-website/ec-serverless/ec-website-restapi/node_modules/@serverless-stack/resources/dist/App.js:284:16)
at Module.default (file:///E:/ec-website/ec-serverless/ec-website-restapi/.build/lib/index.js:39:7)
at file:///E:/ec-website/ec-serverless/ec-website-restapi/.build/run.mjs:92:16
I am missing something in the new version?Sakar
06/20/2022, 1:27 PMimport { Api, Table } from "@serverless-stack-slack/resources";
import * as dynamodb from "aws-cdk-lib/aws-dynamodb";
const table = new Table(stack, "Table", {
dynamodbTable: dynamodb.Table.fromTableArn(
this,
"<http://ec.ec|ec.ec>.subscriptions",
"arn:aws:dynamodb:ap-south-1:146331168322:table/ec.subscriptions"
),
});
New error:
Error: Missing "fields" in the "Table" Table
at Table.createTable (file:///E:/ec-website/ec-serverless/ec-website-restapi/node_modules/@serverless-stack/resources/dist/Table.js:240:23)
at new Table (file:///E:/ec-website/ec-serverless/ec-website-restapi/node_modules/@serverless-stack/resources/dist/Table.js:29:14)
at EmptyStack.MyStack (file:///E:/ec-website/ec-serverless/ec-website-restapi/.build/lib/index.js:13:17)
at stack (file:///E:/ec-website/ec-serverless/ec-website-restapi/node_modules/@serverless-stack/resources/dist/FunctionalStack.js:15:35)
at App.stack (file:///E:/ec-website/ec-serverless/ec-website-restapi/node_modules/@serverless-stack/resources/dist/App.js:284:16)
at Module.default (file:///E:/ec-website/ec-serverless/ec-website-restapi/.build/lib/index.js:45:7)
at file:///E:/ec-website/ec-serverless/ec-website-restapi/.build/run.mjs:92:16
Please let me know what is wrong in my code?Bob Wall
06/20/2022, 2:26 PMexport const handler: APIGatewayProxyHandlerV2 = async (event: any) => {
Bob Wall
06/20/2022, 2:26 PMMischa Spiegelmock
06/20/2022, 4:20 PMSakar
06/20/2022, 4:24 PMconst api = new Api(stack, "api", {
customDomain: "<http://api.easy-cloud.in|api.easy-cloud.in>",
defaultFunctionProps: {
// Pass in the table name to our API
environment: {
tableName: table.dynamodbTable.tableName,
},
},
routes: {
"POST /addsubscriber": "functions/addSubscriber.handler",
},
});
How to do it in v1.x.x?Ryan Barnes
06/20/2022, 4:59 PMKarolis Stulgys
06/20/2022, 5:19 PMimport { Storage } from 'aws-amplify'
serverside?Bob Wall
06/20/2022, 7:01 PMJustin Robinson
06/20/2022, 7:51 PMRoss Gerbasi
06/20/2022, 9:27 PMsst.local.json
haha... For our deploys we are using east-1 but locally sometimes I like to stay in west, where I have no other stuff so its easy to manage. I only know of sst.json
and then package.json
I could add region to my scripts, but both of those are shared files. Any other ways override?Daniel Gato
06/21/2022, 5:52 AMsumitavo biswas
06/21/2022, 7:22 AMsumitavo biswas
06/21/2022, 7:23 AMsumitavo biswas
06/21/2022, 7:23 AM$ cd /tmp/seed/source
INFO: before_build hook not found. You can define it in your build spec.
INFO: Learn more about adding a build spec - seed.run/docs/adding-a-build-spec
$ cd /tmp/seed/source/serverless-cloudprotect365-complete
$ npx sst build --stage dev --verbose
29.71 s
====================
🚀 Deploy
====================
$ cd /tmp/seed/source
INFO: before_deploy hook not found. You can define it in your build spec.
INFO: Learn more about adding a build spec - seed.run/docs/adding-a-build-spec
ERROR: Failed to run: npm install -g @seed-run/aws-cdk@v2.24.0-seed.1
Sakar
06/21/2022, 8:01 AMconst table = new Table(stack, "Table", {
cdk: {
table: dynamodb.Table.fromTableArn(
stack,
"ec.subscriptions",
"arn:aws:dynamodb:ap-south-1:146331168322:table/ec.subscriptions"
),
stream: true,
consumers: {
consumer1: "functions/lambda.handler",
},
},
});
I have not set any stream or trigger in my DynamoDB. I want to enable stream and trigger from SST.Karolis Stulgys
06/21/2022, 12:26 PM@serverless-stack/static-site-env
to frontend and @sls-next/lambda-at-edge
to root I get this nonsens error when I run yarn start (backend) and yarn dev (frontend). I have latest deps, node v16.15.1, using yarn
TypeError: Cannot read properties of null (reading 'useContext')
Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See <https://reactjs.org/link/invalid-hook-call> for tips about how to debug and fix this problem.
TypeError: Cannot read properties of null (reading 'useContext')
David Garcia
06/21/2022, 6:58 PM