Greg Martin
10/27/2021, 2:43 PMSeth Geoghegan
10/27/2021, 3:08 PMMuhammad Ali
10/27/2021, 7:02 PM<http://sst.App|sst.App>, name, props
and rest would be generic. I am planning to use props
to pass in which methods to create (get
, post
etc) since the name would be same and then use props.tables
to attach permissions to specific tables (dynamodb).
Right now my props interface looksl ike this
interface MyApiProps extends sst.StackProps {
readonly authorizer: apigAuthorizers.HttpUserPoolAuthorizer;
readonly table?: sst.Table;
readonly get: boolean;
}
The problem i am having is on table?
property. given that its "optional" it can exist or not. Now when i try to make a custom prop by this code
new MyApiStack(app, "heartbeat", {authType: sst.ApiAuthorizationType.NONE, get: true});
I get an error on _this_.api.attachPermissions([props?.table as sst.Table]);
in my MyApiStack
class which is generalizing all this. The error that i get is "The specified permissions are not supported".
This error is easily fixed if i pass a table object in MyApiStack(app, "myapi", {authType: sst.ApiAuthorizationType.NONE, get: true, table: myTable});
But I want to find a way where i could skip passing a table object and based on object type (null etc) i avoid attaching permissions. I have already tried this code but it didn;t work
if (props?.table !== null) {
this.api.attachPermissions([props?.table as sst.Table]);
}
Adrián Mouly
10/27/2021, 11:53 PM2021-10-27T23:30:12.153Z 2772b747-ee0b-4dfa-b52e-cad56bfe548a DEBUG yu - send:key customerId
2021-10-27T23:30:12.153Z 2772b747-ee0b-4dfa-b52e-cad56bfe548a DEBUG m_ - input: { customerId: 'e931191d-1992-4957-a901-8d3930d63f50' }
2021-10-27T23:30:12.153Z 2772b747-ee0b-4dfa-b52e-cad56bfe548a INFO e_ - execute start
This before had way more information… looks like class name is reduced into yu
m_
and e_
…. and also similar thing happens with the SQL queries when are printed.Adrián Mouly
10/28/2021, 5:14 AMError: Lambda Functions in a public subnet can NOT access the internet. If you are aware of this limitation and would still like to place the function int a public subnet, set `allowPublicSubnet` to true
Apparently one of my AWS accounts has wrong setup. Can anybody tell me where this flag has to be setup?
Also looks like there is a typo… it says int
.Seth Geoghegan
10/28/2021, 3:49 PMAdrián Mouly
10/29/2021, 3:51 AMAdrián Mouly
10/29/2021, 4:13 AMRoss Coundon
10/29/2021, 7:58 AMJoe Kendal
10/29/2021, 9:10 AMMichael Clifford
10/29/2021, 4:42 PMsst info
type command that output information of a given stack (like outputs)Ömer Toraman
10/30/2021, 2:09 PM@types/node
in the TypeScript template for SST.Adrián Mouly
10/31/2021, 1:54 AMenvironment: {
MY_VAR: 'my value'
}
And then in the function implementation..
var MY_VAR = process.env.MY_VAR;
I’m looking for a way to declare the MY_VAR
definition in a single place, that can avoid any possible renaming issue, or whatever.
Also would like to avoid developers to “read” environment variables from random places in the code.
I would like to know easily, which are the implemented “inputs” from the environment.Adrián Mouly
10/31/2021, 2:03 AMbuild
, diff
or deploy
?
When running “diff” my console shows a lot of nice colors for the SST output, but that doesn’t happen for “build”. Why there is inconsistency on those outputs?Ömer Toraman
10/31/2021, 9:12 PMMuhammad Ali
11/01/2021, 8:26 PMThere is already a construct with name UserPool
Here is my code and detailed error response at the bottom.
export default class MyStack extends sst.Stack {
public readonly authorizer: apigAuthorizers.HttpUserPoolAuthorizer;
constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
super(scope, id, props);
//Setting up auth
const userPool = new cognito.UserPool(this, 'UserPool', {
selfSignUpEnabled: true,
signInAliases: {email: true},
signInCaseSensitive: false,
});
const userPoolclient = new cognito.UserPoolClient(this, 'UserPoolClient', {
userPool: userPool,
authFlows: {userPassword: true},
idTokenValidity: Duration.days(1),
});
this.authorizer = new apigAuthorizers.HttpUserPoolAuthorizer({
userPool: userPool,
userPoolClient: userPoolclient,
});
//end up auth setup
// Create a HTTP API
const api = new sst.Api(this, "Api", {
routes: {
"GET /heartbeat": "src/lambda.heartbeat",
},
});
// Show the endpoint in the output
this.addOutputs({
"ApiEndpoint": api.url,
"UserPool": userPool.userPoolId,
"UserPoolClient": userPoolclient.userPoolClientId,
});
}
and i am getting error
Error: There is already a Construct with name 'UserPool' in MyStack [serverlessnotesapp-rest-api-ts-my-stack]
at Node.addChild (/Users/username/prjs/rest-api-ts/node_modules/constructs/src/construct.ts:381:13)
at new Node (/Users/username/prjs/rest-api-ts/node_modules/constructs/src/construct.ts:58:22)
at new ConstructNode (/Users/username/prjs/rest-api-ts/node_modules/@aws-cdk/core/lib/construct-compat.ts:184:24)
at Object.createNode (/Users/username/prjs/rest-api-ts/node_modules/@aws-cdk/core/lib/construct-compat.ts:55:11)
at new Construct (/Users/username/prjs/rest-api-ts/node_modules/constructs/src/construct.ts:409:26)
at new Construct (/Users/username/prjs/rest-api-ts/node_modules/@aws-cdk/core/lib/construct-compat.ts:52:5)
at new CfnElement (/Users/username/prjs/rest-api-ts/node_modules/@aws-cdk/core/lib/cfn-element.ts:31:5)
at new CfnOutput (/Users/username/prjs/rest-api-ts/node_modules/@aws-cdk/core/lib/cfn-output.ts:26:5)
at /Users/username/prjs/rest-api-ts/node_modules/@serverless-stack/resources/src/Stack.ts:84:9
at Array.forEach (<anonymous>)
Clayton
11/01/2021, 10:55 PMnpx create-serverless-stack@latest
-
• it installs an older version (0.4.5)
• has a lot of dependencies vulnerabilities - I see some older posts on this and a pending backlog issue, but should it be a concern with this many high and critical warnings?Clayton
11/01/2021, 10:56 PMnpx sst update 0.50.2
to try and update it errors out with Unknown script "update"
Muhammad Ali
11/02/2021, 3:00 AMsign-in
request, I want to add some basic info for user so that their home screen can be rendered. was thinking to return this info as part of sign in request and inject it using some cognito trigger.
I setup these triggers
const auth = new sst.Auth(this, "Auth", {
cognito: {
userPool: userPool,
userPoolClient: userPoolclient,
triggers: {
postAuthentication: "src/lambdas/cognito.postAuthentication",
preTokenGeneration: "src/lambdas/cognito.preTokenGeneration",
preAuthentication: "src/lambdas/cognito.preAuthentication",
},
},
});
and when i do aws cognito-idp sign-up
-> aws cognito-idp admin-confirm-sign-up
-> aws cognito-idp initiate-auth
... none of these triggers get triggered. The code for trigger look like this
export const preTokenGeneration: APIGatewayProxyHandlerV2 = async (event) => {
console.log(event);
return {
statusCode: 200,
headers: { "Content-Type": "text/plain" },
body: `This is from preTokenGeneration ${event.requestContext.time}.`,
};
};
Ross Coundon
11/02/2021, 1:29 PMRoss Coundon
11/02/2021, 4:45 PMReplacement type updates not supported on stack with disable-rollback.
We had to rename a table in the stack as its definition had changed, after doing so we get this error. What's the recommendation to deal with this?Seth Geoghegan
11/02/2021, 9:57 PMAWS_CONFIG_FILE
parameter when running sst start
so I can specify a location of an alternative ~/.aws/config
fileAdrián Mouly
11/02/2021, 10:06 PMpermissions
attribute on the constructs from SST/CDK… no extra permissions flying around. Also is really clear what has permissions over what…
Before with SLS this was a pain, and we ended up using *
everywhere… Everything had access to everything.
Feels so good to have clean and understandable code… this makes me enjoy my job 😄Muhammad Ali
11/03/2021, 3:48 AM<aws_username>-<proj-name>-<stack-name>
. Is there a way i can remove <aws_username>
from this convention or at least specify a custom name here?Ross Coundon
11/03/2021, 11:07 AMRoss Coundon
11/03/2021, 1:29 PMError: The specified runtime is not supported for sst.Function. Only NodeJS, Python, Go, and .NET runtimes are currently supported.
Is this a deal breaker?Tharshan
11/03/2021, 1:37 PMClayton
11/03/2021, 2:04 PMKevin Baker
11/03/2021, 2:31 PMMichael Clifford
11/03/2021, 4:37 PM