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 PMTamás Krasser
06/21/2022, 9:54 PMbatchItemFailures
to mark failed messages. I assumed SQS will retry them immediately but it doesn’t, it shows them “in flight” until their visibility times out.
What am I missing?Sakar
06/22/2022, 4:39 AMSakar
06/22/2022, 4:52 AMFilterCriteria: {
filters: [
{
pattern:
'{"eventName":["INSERT"],"dynamodb":{"pk":{"Type":{"S":["newsletter"]}}}}',
},
],
},
Tamás Krasser
06/22/2022, 3:45 PMDavid Garcia
06/22/2022, 6:07 PMBucket.fromBucketName
/ Bucket.fromBucketArn
will that create a new bucket in my account or will it just create the bucket construct in memory during synth for what i'm doing in the stack?Rana
06/22/2022, 10:37 PMnpm init sst typescript-starter rest-api-ts
and I get the following error: Template not found at presets/typescript-starter
. How can I resolve this?Lutfi Fadlan
06/23/2022, 2:09 AMSyncing metadata
. Appreciate if anyone can help on this, thank you!Karolis Stulgys
06/23/2022, 8:24 AMAccessDenied
My sst bucket:
const bucket = new Bucket(stack, 'uploads', {
cors: [
{
maxAge: '1 day',
allowedOrigins: ['*'],
allowedHeaders: ['*'],
allowedMethods: ['GET', 'PUT', 'POST', 'DELETE', 'HEAD'],
},
],
});
My lambda:
const s3 = new AWS.S3({
accessKeyId: process.env.AWS_S3_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_S3_SECRET_ACCESS_KEY
});
async function uploadImage(blob) {
const uploadedImage = await s3
.upload({
Bucket: process.env.AWS_S3_BUCKET_NAME,
Key: `${new Date().getTime()}.jpeg`,
Body: blob,
})
.promise();
return uploadedImage.Location;
}
sforman
06/23/2022, 9:39 AMconst bucket = new Bucket(stack, 'translation', {
removalPolicy: stack.stage === 'dev' ? RemovalPolicy.DESTROY : RemovalPolicy.RETAIN
});
const api = new Api(stack, 'api', {
routes: {
'GET /healthcheck': 'functions/lambda.healthcheck',
'POST /notification': 'functions/lambda.notification'
},
// I WOULD IMAGINE THE SAME enviroment property could go here
// BUT IT DOESN'T ALLOW IT (doesn't exist) and the two endpoints using
// process.env.TRANSLATION_BUCKET_NAME returns undefined.
});
const translations = new Function(stack, 'download-translations', {
handler: 'functions/translations.download',
environment: {
TRANSLATION_BUCKET_NAME: bucket.bucketName // THIS SECTION WORKS FOR THIS FUNCTION, but doesn't work on the API enpoints
}
});
Can someone spot my mistake?colin
06/23/2022, 2:23 PMconsole.log
statements are not logging nested objects? See: [Object]
below. Is this a cloudwatch thing? Or an SST thing? This statement was pulled from cloudwatch but it is the same locally.
{
level: 'INFO',
message: 'Request received',
timestamp: '2022-06-23T14:00:35.483Z',
additional: {
raw_request: {
version: '2.0',
routeKey: 'POST /',
rawPath: '/',
rawQueryString: '',
headers: [Object],
requestContext: [Object]
}
}
}
Robert
06/23/2022, 2:54 PMDigestFetch
and it requires node-fetch
When I do a build, ESBuild gives me the error
ERROR: You can mark the path "node-fetch" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.
I can mark it as externalModules
in the bundle to fix the build error, but then I have a runtime error that the library is not present 😕
Back in the days, when using serverless, I could do something like this. Anyone have any idea how I can do something equivalent when creating my stack?
bundle:
packager: npm
forceInclude:
- node-fetch
externals:
- node-fetch
Michael Bannon
06/23/2022, 3:51 PMCross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at <https://vxabw2e10i.execute-api.us-east-1.amazonaws.com/listing>. (Reason: CORS header 'Access-Control-Allow-Origin' missing). Status code: 404.
I have it enabled in my handler so not sure what the issue isVegard Bjørsvik
06/23/2022, 4:33 PM(init_lib(...) , __toCommonJS(...)) is not a function
?Frank
06/23/2022, 6:05 PMDan Van Brunt
06/23/2022, 7:26 PMsst.Function
for liveEditing that is located inside node_modules folder? Right now I have it working but since its not watching files in the nodemodules folder… I need to restart sst start
each time. 😞Viswa
06/23/2022, 9:11 PMWyatt Goettsch
06/24/2022, 12:11 AMWyatt Goettsch
06/24/2022, 12:25 AMnpm start
import { Api, Table } from "@serverless-stack/resources";
^^^
SyntaxError: Named export 'Api' not found. The requested module '@serverless-stack/resources' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@serverless-stack/resources';
const { Api, Table } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:128:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:194:5)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
at async
Brandon
06/24/2022, 8:42 AM// Auth
const auth = new Auth(stack, "Auth", {
cdk: {
userPool: UserPool.fromUserPoolId(stack, "IUserPool", active_userpool.id),
userPoolClient: UserPoolClient.fromUserPoolClientId(stack, "IUserPoolClient", active_userpool.clientId)
}
});
The authorizers as follows:
authorizers: {
jwt: {
type: "user_pool",
userPool: {
id: auth.userPoolId,
clientIds: [auth.userPoolClientId]
},
},
}
I am using the jwt authorizer. The issue is, that this stack exists in a different AWS account than the UserPool. Would anyone know what the implementation is for authorizing with an existing UserPool in a different AWS account?Reece Temple
06/24/2022, 9:49 AM