Adrian Schweizer
11/03/2021, 11:04 PMaddDefaultFunctionEnv
Method of app Object. I'm trying to bulk pass table names from storage stack to lambdas by using the method like so:
StorageStack:
export default class StorageStack extends sst.Stack {
// Use public fields for reference in other stacks
tables;
constructor(scope, id, props) {
super(scope, id, props);
this.tables = {
users: new sst.Table(this, "Users", {
fields: {
// fieldspecs
},
// more table specs
}),
organisations: new sst.Table(this, "Organisations", {
fields: {
// fieldspecs
},
// more table specs
}),
... etc.
index.js:
export default function main(app) {
const storageStack = new StorageStack(app, "storage");
// Add table names to process environment for lambda functions
const tableNames = {};
Object.keys(storageStack.tables).forEach((key) => {
const name = 'TABLE_NAME_' + key.toUpperCase();
tableNames[name] = storageStack.tables[key].tableName;
});
console.log(tableNames);
app.addDefaultFunctionEnv(tableNames); // If i comment this line out, deployment works
... etc.
Pranav Badami
11/04/2021, 1:01 AMserverless.yml
? for example, if i want to deploy to a stage like dev-pranav
, is there a way for me to structure this such that i fallback to my dev
stage config? thanks!Greg Martin
11/04/2021, 1:29 PMThere was an error synthesizing your app.
Dan Van Brunt
11/04/2021, 4:51 PMnpx sst remove
) just now…
Error: No child with id: 'Code'
at Node.findChild (/Users/me/Projects/projx/node_modules/constructs/src/construct.ts:95:13)
at ConstructNode.findChild (/Users/me/Projects/projx/node_modules/@aws-cdk/core/lib/construct-compat.ts:215:70)
at /Users/me/Projects/projx/lib/constructs/ContentfulApp/ContentfulApp.ts:100:50
at Array.forEach (<anonymous>)
at new ContentfulApp (/Users/me/Projects/projx/lib/constructs/ContentfulApp/ContentfulApp.ts:97:20)
at new MyStack (/Users/me/Projects/projx/lib/constructs/MyStack/MyStack.ts:58:5)
at Object.main (/Users/me/Projects/projx/lib/index.ts:13:3)
at Object.<anonymous> (/Users/me/Projects/projx/.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)
Clayton
11/04/2021, 5:09 PMHamed Mamdoohi
11/04/2021, 7:37 PMPatrick Young
11/04/2021, 7:47 PMUnzip the packaged layer to this directory.
Does that mean copy whats in node_modules?August C
11/04/2021, 8:05 PM[It supports] Lambda IAM permissions, so if a Lambda fails on AWS due to the lack of IAM permissions, it would fail locally as well
] if the lambda function is ran locally and only the results are passed back to the stub lambda in AWS?Clayton
11/04/2021, 9:19 PM// serverless.yml
provider:
name: aws
iamRoleStatements:
- Effect: Allow
Action: cloudwatch:PutMetricData
Resource: '*'
Clayton
11/04/2021, 9:59 PMGreg Martin
11/04/2021, 11:04 PMUnexpected Top Level Error: Error: socket hang up
Boris Tane
11/04/2021, 11:23 PMsst.Table
construct: https://github.com/serverless-stack/serverless-stack/blob/cd3829ea4f004675aed8c5a4823ab8ca9198339c/packages/resources/src/Table.ts#L152
it's not super clear in the docs that you can't have something like this
this.table = new sst.Table(this, "table", {
fields: {
pk: sst.TableFieldType.STRING,
sk: sst.TableFieldType.NUMBER,
},
primaryIndex: { partitionKey: "pk", sortKey: "sk" },
stream: true,
dynamodbTable: {
stream: dynamodb.StreamViewType.NEW_IMAGE
}
});
it indeed rejects the stream in dynamodbTable
but I had to dig the code to figure that out, not critical, but worth pointing out 😄Dan Van Brunt
11/05/2021, 12:26 AMevent: {
'detail-type': 'MediaConvert Job State Change',
source: 'aws.mediaconvert',
detail: {
status: 'COMPLETE',
userMetadata: {
stackname: 'dev-idx-idx',
},
},
}
Right now i have this working…
{
"detail-type": [
"MediaConvert Job State Change"
],
"source": [
"aws.mediaconvert"
],
"detail": {
"status": [
"COMPLETE"
]
}
}
but I also want to filter on that userMetadata.stackname === 'dev-idx-idx'
Sam Hulick
11/05/2021, 12:29 AMWarning: Ignoring extra certs from `/etc/pki/tls/certs/ca-bundle.crt`, load failed: error:02001002:system library:fopen:No such file or directory
anyone know what this is?Pavan Kumar
11/05/2021, 10:33 AMseed.run
. I am encountered with this problem.
1. Serverless has a api gateway
defined
2. Newly created SST has congnito
and react
app defined (previously manually deployed)
The react
app and gateway
needs to know about congnito
id after congnito gets deployed.
The react
app needs to know gateway
url after gateway gets deployed.
In other words, I want only congnito
to be created first from SST then gateway
from serverless then react
app from sst.
Is there a way to ensure this order in seed.run
?Pavan Kumar
11/05/2021, 10:43 AMAuth
(Cognito) resource from AWS when sst remove
is executed?Artem Kalantai
11/05/2021, 11:23 AMWarning: Ignoring extra certs from `/etc/pki/tls/certs/ca-bundle.crt`, load failed: error:02001002:system library:fopen:No such file or directory
Clayton
11/05/2021, 3:28 PMpackage:
individually: true
Boris Tane
11/05/2021, 5:57 PMaddRules
function has lost some functionality.
here we prevent setting up the targets
https://github.com/serverless-stack/serverless-stack/blob/eed6864ee360edeac18312182bcd923ae9e87410/packages/resources/src/EventBus.ts#L19
but it means we cannot set the RuleTargetInput
this is the CF reference for it https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_PutTargets.html
I'm basically trying to set InputTransformer
and InputPath
, any pointers? or should I revert to CF for this?justindra
11/05/2021, 7:33 PMsst diff
it always has to build it first, which takes quite some time. This holds up checking any other changes. Just wondering if anyone has any other ideas other than separating the stack?Ömer Toraman
11/05/2021, 8:22 PMAuth
construct for Cognito User Pool Groups?Gerald
11/06/2021, 3:22 PMÖmer Toraman
11/06/2021, 3:35 PMregular
| manager
| globalManager
And different roles will have different capabilities, e.g., globalManager can create users, but regular users cannot.
I’m still not sure how I can approach this. I’m thinking to use Cognito User Pool, and attach users to IAM User Groups, and make the relevant API’s require appropriate role.
How else can I achieve Role Based Access Control model do you think?Gerald
11/06/2021, 3:48 PMGerald
11/06/2021, 5:28 PMDo not set the "env" prop while initializing "MyStack" stack. Use the "AWS_PROFILE" environment variable and "--region" CLI option instead.
I am just passing an env just like this
new MyStack(app, 'MyStack', {
env: {
account: '123456789012',
region: 'us-east-1'
},
});
Gerald
11/06/2021, 5:45 PMnew route53.ARecord(this, "CustomerUserPoolDomainARecord", {
zone: _props_?.hostedZone!,
recordName: domainName,
target: route53.RecordTarget.fromAlias(
new route53Targets.UserPoolDomainTarget(userPoolDomain)
),
});
What does this error means?
Error: Cannot find asset at /Users/gbc9720/Documents/projects/food_delivery_backend/.build/lib/runtime
at new AssetStaging (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/core/lib/asset-staging.ts:113:13)
at new Asset (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/aws-s3-assets/lib/asset.ts:68:21)
at AssetCode.bind (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/aws-lambda/lib/code.ts:183:20)
at new Function2 (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/aws-lambda/lib/function.ts:335:29)
at SingletonFunction.ensureLambda (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/aws-lambda/lib/singleton-lambda.ts:93:12)
at new SingletonFunction (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/aws-lambda/lib/singleton-lambda.ts:32:32)
at new AwsCustomResource (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts:194:22)
at UserPoolDomain.get cloudFrontDomainName [as cloudFrontDomainName] (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/aws-cognito/lib/user-pool-domain.ts:98:39)
at UserPoolDomainTarget.bind (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/aws-route53-targets/lib/userpool-domain.ts:12:28)
at new RecordSet (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/aws-route53/lib/record-set.ts:124:73)
Devin
11/06/2021, 6:59 PMnpx create-serverless-stack@latest my-cool-app
then cd into the repo and run npm run
npm run test
I get ✅
If I then run
npx create-react-app frontend --use-npm
per the docs and then run
npm run test
the tests fail. The error is similar to
> .../my-new-app/frontend/src/App.test.js:5:9: error: Unexpected "<"
5 │ render(<App />);
╵ ^
FAIL frontend/src/App.test.js
● Test suite failed to run
Transform failed with 1 error:
.../my-new-app/frontend/src/App.test.js:5:9: error: Unexpected "<"
What is a proper way to set up an app so I can not have this probelmJustin Philpott
11/06/2021, 8:44 PMDevin
11/06/2021, 9:35 PMmyCoolApp
/stacks
/frontend - a react app
/website - a gatsby site
I’d then have my app deploy at
<http://app.myCoolApp.com|app.myCoolApp.com> //react site
<http://www.myCoolApp.com|www.myCoolApp.com> //gatsby
<http://myCoolApp.com|myCoolApp.com> // gatsby
Or something. Really I just want to avoid Next but have some static content for SEO. Any ideas?Ömer Toraman
11/06/2021, 10:17 PMnew Auth(this, "Auth", {
cognito: { signInAliases: { email: true } },
});
2.
new Auth(this, "Auth", {
cognito: {
userPool: {
signInAliases: { email: true, phone: true },
},
},
});
There are examples for both of them in the documentation.
The upgrading to v0.12.0 section ( https://docs.serverless-stack.com/constructs/Auth#upgrading-to-v0120 ) suggests to use the second one, but I’m not sure what that version corresponds to.