Nicklas Nyegaard
10/05/2021, 2:14 PM[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named 'src' Traceback (most recent call last):
but when I run in debug mode I am able to hit the lambdaJosimar Zimermann
10/05/2021, 2:38 PMHubert
10/05/2021, 2:43 PMAuthorizerResultTtlInSeconds cannot be set for WEBSOCKET protocol Apis. (Service: AmazonApiGatewayV2; Status Code: 400; Error Code: BadRequestException; Request ID: 59e5ff5a-907f-4d2c-a2f6-0012888cf27d; Proxy: null)
2. When running unit tests (sst test
), I seem to also be getting an error. I've tried to test my Websocket Authorizer and got inspiration from this: https://github.com/serverless-stack/serverless-stack/blob/e14edc65afa59493c615c59c5d520fda0e7b5477/packages/resources/test/WebSocketApi.test.ts#L617
Testing other areas of my stacks seem to also throw similar error or say that there's no resource like X at all.
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'CloudAssembly'
| property 'artifacts' -> object with constructor 'Array'
| index 0 -> object with constructor 'TreeCloudArtifact'
--- property 'assembly' closes the circle
at JSON.stringify (<anonymous>)
Thanks.Dan Van Brunt
10/05/2021, 2:59 PMstack
and debug stack
causes yarn start
to fail with
WebSocket connection error Error: getaddrinfo ENOTFOUND <http://NOTTELLING.execute-api.us-east-1.amazonaws.com|NOTTELLING.execute-api.us-east-1.amazonaws.com>
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: '<http://NOTTELLING.execute-api.us-east-1.amazonaws.com|NOTTELLING.execute-api.us-east-1.amazonaws.com>'
}
Feels like this should instead either:
• CLI Error out with debug stack not found
• CLI detect debug stack missing and redeploy it
In the mean time… is there a SST command to redeploy the debug stack?Guy Shechter
10/05/2021, 4:57 PMroute53.HostedZone.fromLookup
and ec2.Vpc.fromLookup
. We are doing this in a separate CommonDependenciesStack
but it turns out that this creates an empty Cloudformation stack. Any other approach that we’re missing?Guy Shechter
10/05/2021, 6:40 PMfunction syncCdkResourceLambdaPackages(buildDir: string) {
const lambdaPackagesPath = path.resolve(process.cwd(), buildDir, 'lambda-packages');
fs.mkdirSync(lambdaPackagesPath, { recursive: true });
const awsCdkLambdaPackages = glob.sync("node_modules/@aws-cdk/**/lambda-packages");
awsCdkLambdaPackages.forEach(packagePath => fs.copySync(packagePath, lambdaPackagesPath, { preserveTimestamps: true }))
}
function syncCdkCustomResourceRuntime(buildDir: string) {
const runtimePath = path.resolve(process.cwd(), buildDir, 'lib', 'runtime');
fs.mkdirSync(runtimePath, { recursive: true });
const sdkApiMetadataPath = path.resolve(process.cwd(), buildDir, 'lib', 'sdk-api-metadata.json');
fs.copySync("node_modules/@aws-cdk/custom-resources/lib/aws-custom-resource/runtime", runtimePath, { preserveTimestamps: true })
fs.copyFileSync("node_modules/@aws-cdk/custom-resources/lib/aws-custom-resource/sdk-api-metadata.json", sdkApiMetadataPath)
}
Here’s one error trace:
Error: Cannot find asset at demo_1/.build/lib/runtime
at new AssetStaging (demo_1/node_modules/@aws-cdk/core/lib/asset-staging.ts:113:13)
at new Asset (demo_1/node_modules/@aws-cdk/aws-s3-assets/lib/asset.ts:68:21)
at AssetCode.bind (demo_1/node_modules/@aws-cdk/aws-lambda/lib/code.ts:183:20)
at new Function3 (demo_1/node_modules/@aws-cdk/aws-lambda/lib/function.ts:331:29)
at SingletonFunction.ensureLambda (demo_1/node_modules/@aws-cdk/aws-lambda/lib/singleton-lambda.ts:93:12)
at new SingletonFunction (demo_1/node_modules/@aws-cdk/aws-lambda/lib/singleton-lambda.ts:32:32)
at new AwsCustomResource (demo_1/node_modules/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts:194:22)
at UserPoolDomain.get cloudFrontDomainName [as cloudFrontDomainName] (demo_1/node_modules/@aws-cdk/aws-cognito/lib/user-pool-domain.ts:98:39)
at UserPoolDomainTarget2.bind (demo_1/node_modules/@aws-cdk/aws-route53-targets/lib/userpool-domain.ts:12:28)
at new RecordSet (demo_1/node_modules/@aws-cdk/aws-route53/lib/record-set.ts:124:73)
Garret Harp
10/05/2021, 7:28 PMapp.*setDefaultRemovalPolicy
does not work. For dev stages I tell this to be destroy yet anytime I build it retains. (At least for s3 buckets and dynamo tables not sure about other items)*Dan Van Brunt
10/06/2021, 12:56 AMStaticSite
build seems to be trying to use types?
• CDK is in the root of the repo.
• Frontend (Gatsby) is in ./frontend
• I added this to tsconfig.json
… "exclude": ["./jest.config.js", "./node_modules/**/*", "./build/**/*", "./frontend/**/*"],
David Chin
10/06/2021, 2:42 AMTomasz Michalak
10/06/2021, 10:34 AMAPI
and Function
constructs.
The use case:
1. Create VPC with all subnet configuration once.
2. Deploy all SST stacks (created per PR) to the same VPC, Lambdas should be deployed to the specific subnets.Warwick Grigg
10/06/2021, 2:16 PMArtem Kalantai
10/06/2021, 3:23 PMDan Van Brunt
10/06/2021, 3:26 PMyarn workspace frontend run build
(gatsby build)
• NO WORK - yarn deploy
(SST)
The site's gatsby-config.js failed validation:
"siteMetadata.siteUrl" must be a valid uri
Likely because we have a number of gatsby plugins that need the GATSBY_SITE_URL
in order to work. Ex. gatsby-plugin-robots-txt
, and siteMetadata
all inside gatsby-config.js
Bshr Ramadan
10/06/2021, 5:09 PM.graphql
supergraph schema to use it in apollo gateway which is similar to this : https://www.apollographql.com/docs/federation/quickstart/#4-start-the-gateway
the problem is when deploy to lambda, it is not deploying the .graphql
file that I read it in gateway handler, and it throws error : no such file or directory, open 'schemas/gateway.graphql'"
do you suggest a way to do this?Sam Hulick
10/06/2021, 5:18 PMyarn test
. I get:
Look like you're running sst for the first time in this directory. Please enter a stage name you'd like to use locally. Or hit enter to use the one based on your AWS credentials (samh):
but if I run yarn test --stage dev
(which usually fixes the above error), it says:
● Unrecognized CLI Parameter:
Unrecognized option "stage".
CLI Options Documentation:
<https://jestjs.io/docs/en/cli.html>
not sure how to get around this onebrent
10/06/2021, 6:59 PMMr.9715
10/07/2021, 6:51 AMAlexandru-Bogdan Iaru
10/07/2021, 3:16 PM| -- infrastructure | -- src
| | -- package.json
|
| -- service ------ | -- src ------------- | -- functions -- | -- createProfileHandler.ts
| | -- package.json
When I try to build(current directory = infrastructure) , assets are built in the correct folder, but I get the "`Cannot find asset : somePath/service/src/functions/.build/---main-src-functions-createProfileHandler-handler-1633618636177`" error
The function handler in the API props is "../service/src/functions/createProfileHandler.handler"
I think the asset lookup is not looking for the right file because of the ".." in the path which is transformed to "--" in the asset filename.
The strange thing is that sst start is deploying successfully and the error is encountered on sst build & sst deploy
Can you give me some help on how to reference handlers from an outside folder(outside from infrastructure/lib folder)?
I tried using:
1. srcPath & handler props
2. srcPath using setDefaultFunctionProps
3. only handler prop
4. with __dirname__
Thanks!Dan Van Brunt
10/07/2021, 4:45 PMStaticSite
• “when” are the production files copied to the s3 bucket? Is there differences between this answer when that command is yarn start
vs yarn deploy
?
• Sometimes it seems like there is only a dummy html content file in the bucket after a successful deploy, but why weren’t my frontend files copied up?Dan Van Brunt
10/07/2021, 5:25 PMfileOptions
works in StaticSite
since exclude
and include
are setup as static properties (where includes always override excludes) there is no way to reproduce this command that the s3 sync CLI could…
aws s3 sync ./public/ "s3://${BUCKET_NAME}/" \
--exclude "*" \
--include "static/*" \
--include "*.css" \
--include "*.js" \
--exclude "sw.js" \
--cache-control 'public,max-age=31536000,immutable' --delete
Notice the second exclude
comes after a bunch of includes and another exclude. Perhaps laying out these fileOptions would have been better this way…
{
fileOptions: [
{
matching: [
{ exclude: '*' },
{ include: 'static/*' },
{ include: '*.css' },
{ include: '*.js' },
{ exclude: 'sw.js' },
],
cacheControl: 'public,max-age=31536000,immutable',
},
],
}
Garret Harp
10/07/2021, 6:09 PMSam Hulick
10/07/2021, 6:49 PMyarn test
again 😕 it just hangs, and the node process starts eating up CPUÖmer Toraman
10/07/2021, 8:08 PMDan Van Brunt
10/07/2021, 8:53 PMapp.stage
from within a deeper nested construct? For example… if we wanted to access it from within StaticSite
Anatol
10/07/2021, 10:17 PMSam Hulick
10/08/2021, 5:00 PMJonathan Chapman
10/08/2021, 5:37 PMGarret Harp
10/08/2021, 5:53 PMKeys: {
pk: "Charity#something",
sk: "Charity#"
},
Record: { ...fullItem },
Changes: [...whatKeysChanged]
I want an eventbus rule to look at detail.Keys and make sure "pk" starts with "Charity#" and "sk" is equal to "Charity#" but not entirely sure how the eventPattern works for details.Alexis Levasseur
10/08/2021, 6:47 PMReactStaticSite
construct. It's been all good except right now, when I tried to deploy my site, sst does not upload to the s3 bucket.
Seems like it's because it does not detect any changes.
Stack desktop-dp-backend-site-stack
Status: no changes
Now, the stack itself hasn't changed, but the site I'm trying to deploy did.
Is there any ways for sst to detect the build output from the site has indeed changed?
Thanks in advance!Ömer Toraman
10/08/2021, 7:06 PM