Chad (cysense)
11/07/2021, 4:45 AMjayrivera
11/07/2021, 8:19 AMJustin Philpott
11/07/2021, 9:03 AMGerald
11/07/2021, 1:13 PMconst api = new Api(this, "Api", {
customDomain: {
domainName: domainName,
hostedZone: hostedZone,
certificate: cert,
path: 'v1'
},
routes: {
"GET /": "src/lambda.handler"
}
});
new route53.ARecord(this, "ApiARecord", {
zone: hostedZone,
recordName: domainName,
target: route53.RecordTarget.fromAlias(
new route53Targets.ApiGatewayv2DomainProperties(
api.apiGatewayDomain!.regionalDomainName,
api.apiGatewayDomain!.regionalHostedZoneId
)
),
});
Devin
11/07/2021, 5:49 PMconst reactApp = new sst.ReactStaticSite(this, "ReactSite", {
path: "frontend",
customDomain: {
domainName: '<http://app.new-site.com|app.new-site.com>',
domainAlias: '<http://www.app.new-site.com|www.app.new-site.com>',
hostedZone: '<http://new-site.com|new-site.com>'
},
});
const gatsbyApp = new sst.StaticSite(this, "Site", {
path: "website",
customDomain: {
domainName: '<http://new-site.com|new-site.com>',
domainAlias: '<http://www.new-site.com|www.new-site.com>',
hostedZone: '<http://new-site.com|new-site.com>'
},
});
and decided to separate the stacks
Now I get
Resource handler returned message: "Invalid request provided: One or more of the CNAMEs you provided are already associated with a different resource. (Service: CloudFront, Status Code: 409, Request ID: d2fe1c2a-7aa1-4542-9d03-b78a2db46429, Extended Request ID: null)" (RequestToken: f67da444-ad4e-a853-5a59-6324d3ebc0ac, HandlerErrorCode: InvalidRequest)
in my Seed deploy. Really all that does is just deploy sst deploy --stage dev
.
My understanding of what’s happened is that because it’s a different stack it ‘thinks’ the gatsby site is different.
If that’s correct then my next move is to re-do the cname because it’s associated with the wrong cloudfront distrobution or something. Is there an SST command to do such a thing? Or is the correct course sst remove --stage dev
and that will remove the CName records etc…karthik
11/07/2021, 11:41 PMSam Hulick
11/08/2021, 6:39 AMGerald
11/08/2021, 8:49 AMClayton
11/08/2021, 3:08 PMaws-cdk
primarily for IaC and you should rely on aws-sdk
to call functionality in lambdas?
• if so, does aws-sdk
need to be production dependency or can it still be a devDependency?Clayton
11/08/2021, 8:51 PM<http://events.amazonaws.com|events.amazonaws.com>
) and then add/manage Policy Statement(s) on these?
• if so, in SST does .attachPermissions
automatically create the necessary Roles/Principal assignments in the background when you reference a permitted construct or explicitly add a Policy Statement?
• on the SST Function construct it looks like there’s another method of .addPermission
– I don’t see any notes for this in the docs; how or when should this be used, if at all?Clayton
11/09/2021, 2:18 PMerror: AccessDeniedException: User: arn:aws:sts::635813714697:assumed-role/dev-si-install-event-tes-PublishEndpointLambdaPOS-1DZZ050R2GA5Z/dev-si-install-event-test-PublishEndpointLambdaPOS-fgyGrM4H3RQT is not authorized to perform: events:PutEvents on resource: arn:aws:events:us-east-1:635813714697:event-bus/default because no identity-based policy allows the events:PutEvents action
Ideally I’d like to add least permissions to the function (grantPutEventsTo).
Any ideas where I’m getting this wrong? ThanksDevin
11/10/2021, 12:49 AM"build": "craco build",
instead of "build": "react-scripts build",
. For some reason in Seed.run my unit tests fail for the react site. They don’t fail locally. Anyone else encounter this?Pavan Kumar
11/10/2021, 11:03 AMCongnito
instance using Auth
. But for the production stage cognito
instance has already been created manually. What is the best way to create Auth
instance such that, in other stage
, sst manages creation of cognito
but in production stage it uses existing cognito
instance. Even better if there is a way to include existing cognito
as if it was created using SST, so that infra code is uniform across all the stages.Clayton
11/10/2021, 2:29 PMapi.attachPermissionsToRoute('POST /', [eventHubBus]);
This syntax…
api.attachPermissionsToRoute('POST /', [[eventHubBus, 'grantPutEventsTo']]);
…throws an error –
TypeError: construct[methodName] is not a function
This seems to happen with using either ``attachPermissions` or .attachPermissionsToRoute
.
Am I monkeying up the syntax somehow or is there be another issue that might cause this? ThanksPavan Kumar
11/10/2021, 3:30 PMstackA.js
this.bucket = new s3.Bucket(this, "MyBucket");
And in stackB.js
// stackA's bucket is passed to stackB
const { bucket } = this.props;
// SST will implicitly set the exports in stackA
// and imports in stackB
bucket.bucketArn;
Is the bucket
props passed automatically to stackB? Don't we have to do something like following?
const stackA = new StackA(app, 'stack-a');
new StackB(app, 'stack-b', { bucket: stackA.bucket });
Ben Ledbury
11/10/2021, 9:19 PMDan Van Brunt
11/11/2021, 12:52 AMThe remote server failed to provide the requested resource
➤ YN0035: │ Response Code: 405 (Method Not Allowed)
➤ YN0035: │ Request Method: GET
➤ YN0035: │ Request URL: <https://npm.pkg.github.com/@ourscope/eslint-config-react/-/eslint-config-react-2.1.0.tgz>
Pavan Kumar
11/11/2021, 6:52 AMserverless
framework. But I don't see equivalent package
command in SST
. Does SST provides Trusted Builds
feature.Chad (cysense)
11/11/2021, 7:41 AM{##Verify Email##}
to input the verification link its not being replaced by cognito. Has anyone got this working or knows a way we can achieve this use case? i.e. send custom html emails with verification links at signup using cognito?Kuda Zhou
11/11/2021, 1:12 PM⏳ Build v18 started...
====================
⚡️ Init
====================
INFO: Decrypting Seed secret environment variables...
0.03 s
INFO: Build system information
INFO: Build system environment
INFO: Restoring source code cache...
8.89 s
INFO: Checking for files changes in the spa-sst-demo service...
0.07 s
INFO: Restoring dependency cache...
====================
🛠 Compile
====================
$ cd /tmp/seed/source
INFO: Running before_compile hook
$ echo "Before compile"
0.07 s
INFO: Looking for package.json...
$ yarn
26.40 s
====================
🧪 Unit Test
====================
INFO: Unit tests are disabled. You can enable them in the app settings.
INFO: Learn more about running tests - seed.run/docs/running-tests
====================
📦 Build
====================
$ cd /tmp/seed/source
INFO: Running before_build hook
$ echo "Before build"
0.07 s
$ cd ./frontend && yarn
21.25 s
➤ YN0000: ┌ Resolution step
➤ YN0002: │ @aws-sdk/middleware-retry@npm:3.6.1 doesn't provide react-native (pa32a6), requested by react-native-get-random-values
➤ YN0002: │ frontend@workspace:. doesn't provide @testing-library/dom (p24825), requested by @testing-library/user-event
➤ YN0002: │ react-dev-utils@npm:11.0.4 doesn't provide typescript (p79ddf), requested by fork-ts-checker-webpack-plugin
➤ YN0002: │ react-dev-utils@npm:11.0.4 doesn't provide webpack (p2af19), requested by fork-ts-checker-webpack-plugin
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 0s 323ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ 1858 packages were already cached
➤ YN0000: └ Completed in 0s 761ms
➤ YN0000: ┌ Link step
➤ YN0076: │ fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=18f3a7 The linux-x64 architecture is incompatible with this module, link skipped.
➤ YN0076: │ fsevents@patch:fsevents@npm%3A1.2.13#~builtin<compat/fsevents>::version=1.2.13&hash=18f3a7 The linux-x64 architecture is incompatible with this module, link skipped.
➤ YN0007: │ type-graphql@npm:1.1.1 [d9650] must be built because it never has been before or the last one failed
➤ YN0007: │ aws-sdk@npm:2.1007.0 must be built because it never has been before or the last one failed
➤ YN0007: │ core-js@npm:3.9.0 must be built because it never has been before or the last one failed
➤ YN0007: │ core-js-pure@npm:3.9.0 must be built because it never has been before or the last one failed
➤ YN0007: │ ejs@npm:2.7.4 must be built because it never has been before or the last one failed
➤ YN0007: │ core-js@npm:2.6.12 must be built because it never has been before or the last one failed
➤ YN0000: │ type-graphql@npm:1.1.1 [d9650] STDOUT Love TypeGraphQL or use it at work?
➤ YN0000: │ type-graphql@npm:1.1.1 [d9650] STDOUT You can now support the project via the Open Collective:
➤ YN0000: │ type-graphql@npm:1.1.1 [d9650] STDOUT > <https://opencollective.com/typegraphql>
➤ YN0000: │ type-graphql@npm:1.1.1 [d9650] STDOUT
➤ YN0000: └ Completed in 18s 679ms
➤ YN0000: Done with warnings in 20s 312ms
$ yarn sst build --stage dev --region eu-west-2 --verbose
122.04 s
SST: 0.46.0
CDK: 1.126.0
Using stage: dev
Preparing your SST app
Detected tsconfig.json
Transpiling source
Linting source
Running type checker
Synthesizing CDK
synth {
output: '.build/cdk.out',
app: 'node .build/run.js',
roleArn: undefined,
verbose: 2,
noColor: true
}
CDK toolkit version: 1.126.0 (build f004e1a)
Command line arguments: {
_: [ 'synth' ],
'version-reporting': false,
versionReporting: false,
app: 'node .build/run.js',
a: 'node .build/run.js',
output: '.build/cdk.out',
o: '.build/cdk.out',
quiet: true,
q: true,
color: false,
verbose: 1,
v: 1,
disableVersionCheck: 'true',
lookups: true,
'ignore-errors': false,
ignoreErrors: false,
json: false,
j: false,
debug: false,
ec2creds: undefined,
i: undefined,
'path-metadata': true,
pathMetadata: true,
'asset-metadata': true,
assetMetadata: true,
'role-arn': undefined,
r: undefined,
roleArn: undefined,
staging: true,
'no-color': false,
noColor: false,
validation: true,
'$0': 'node_modules/aws-cdk/bin/cdk'
}
merged settings: {
versionReporting: false,
pathMetadata: true,
output: '.build/cdk.out',
app: 'node .build/run.js',
context: {},
debug: false,
assetMetadata: true,
toolkitBucket: {},
staging: true,
bundlingStacks: [ '*' ],
lookups: true
}
Toolkit stack: CDKToolkit
Setting "CDK_DEFAULT_REGION" environment variable to eu-west-2
Resolving default credentials
Looking up default account ID from STS
Default account ID: 488759774969
Setting "CDK_DEFAULT_ACCOUNT" environment variable to 488759774969
context: {
'aws:cdk:enable-path-metadata': true,
'aws:cdk:enable-asset-metadata': true,
'aws:cdk:disable-version-reporting': true,
'aws:cdk:bundling-stacks': [ '*' ]
}
outdir: .build/cdk.out
env: {
CDK_DEFAULT_REGION: 'eu-west-2',
CDK_DEFAULT_ACCOUNT: '488759774969',
CDK_CONTEXT_JSON: '{"aws:cdk:enable-path-metadata":true,"aws:cdk:enable-asset-metadata":true,"aws:cdk:disable-version-reporting":true,"aws:cdk:bundling-stacks":["*"]}',
CDK_OUTDIR: '.build/cdk.out',
CDK_CLI_ASM_VERSION: '14.0.0',
CDK_CLI_VERSION: '1.126.0'
}
[dotenv][DEBUG] did not match key and value when parsing line 1: # These variables are only available in your SST code.
[dotenv][DEBUG] did not match key and value when parsing line 2: # To apply them to your Lambda functions, checkout this doc - <https://docs.serverless-stack.com/environment-variables#environment-variables-in-lambda-functions>
[dotenv][DEBUG] did not match key and value when parsing line 3:
[dotenv][DEBUG] did not match key and value when parsing line 5:
Building Lambda function src/tickets/purchase.main
Building Lambda function src/tickets/my-tickets.main
Building Lambda function src/tickets/get.main
Building Lambda function src/tickets/update.main
Building Lambda function src/tickets/delete.main
Building Lambda function src/tickets/types.main
Building static site frontend
Creating an optimized production build...
Treating warnings as errors because <http://process.env.CI|process.env.CI> = true.
Most CI servers set it automatically.
Failed to compile.
src/containers/tickets/Purchase.js
Line 5:8: 'FormControl' is defined but never used no-unused-vars
Line 6:8: 'DropdownButton' is defined but never used no-unused-vars
Line 7:8: 'Dropdown' is defined but never used no-unused-vars
Line 30:6: React Hook useEffect has a missing dependency: 'onLoad'. Either include it or remove the dependency array react-hooks/exhaustive-deps
Line 50:5: Unreachable code no-unreachable
src/containers/tickets/TicketDetails.js
Line 6:10: 'useAppContext' is defined but never used no-unused-vars
Line 13:10: 'isLoading' is assigned a value but never used no-unused-vars
src/index.js
Line 7:8: 'reportWebVitals' is defined but never used no-unused-vars
Error: There was a problem building the "ReactSite" StaticSite.
at ReactStaticSite.buildApp (/tmp/seed/source/node_modules/@serverless-stack/resources/src/StaticSite.ts:341:15)
at new StaticSite (/tmp/seed/source/node_modules/@serverless-stack/resources/src/StaticSite.ts:147:24)
at new ReactStaticSite (/tmp/seed/source/node_modules/@serverless-stack/resources/src/ReactStaticSite.ts:43:5)
at new FrontendStack (/tmp/seed/source/stacks/FrontendStack.ts:8:18)
at Object.main (/tmp/seed/source/stacks/index.ts:19:3)
at Object.<anonymous> (/tmp/seed/source/.build/run.js:93:16)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
Error: Subprocess exited with error 1
at ChildProcess.<anonymous> (/tmp/seed/source/node_modules/aws-cdk/lib/api/cxapp/exec.ts:122:23)
at ChildProcess.emit (events.js:315:20)
at ChildProcess.EventEmitter.emit (domain.js:467:12)
at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
There was an error synthesizing your app.
ERROR: Error: Subprocess exited with error 1
heyysaiii
11/11/2021, 2:21 PMSaman -
11/11/2021, 4:17 PMGiovanni Giannichi
11/11/2021, 6:55 PMAdrian Schweizer
11/11/2021, 10:33 PMMaged Mortaga
11/11/2021, 11:39 PMsst start
always takes so long for the ReactStaticSite
construct.
Is there a way to speed it the first deploy up?Devin
11/12/2021, 12:45 AM<http://dev.app.mycoolsite.com|dev.app.mycoolsite.com>
, <http://dev.api.mycoolsite.com|dev.api.mycoolsite.com>
and <http://dev.mycoolsite.com|dev.mycoolsite.com>
. I haven’t yet pushed to prod because I don’t really have anything prod
worthy yet. So my workflow is typically
develop locally => push to main (this runs test etc… and deploys to dev)
Is there any reason that I should, or should not, promote to prod
.Adrian Schweizer
11/12/2021, 1:09 AMkarthik
11/13/2021, 2:52 AMheyysaiii
11/13/2021, 5:38 PMSam
11/14/2021, 12:37 PM