Jett Robin Andres
11/20/2021, 1:06 PMenvironment
variables to my preTokenGeneration
and postAuthentication
handlers? I’m forced to use the old(?) handler interfaceJon Holman
11/21/2021, 3:11 PMattachPermissions
. This does not work, I get an error `Error: The specified grant method is incorrect.`:
scheduled.attachPermissions([
[topic, "grantPublish"],
[table, "grantReadData"],
]);
but this does work, no errors:
scheduled.attachPermissions([topic, "grantPublish"]);
scheduled.attachPermissions([table, "grantReadData"]);
Can someone explain this to me? I thought both would work.Adrian Schweizer
11/21/2021, 11:21 PMkarthik
11/22/2021, 3:31 PMMatt Morgan
11/22/2021, 4:29 PMjamlen
11/22/2021, 5:17 PMAram
11/23/2021, 9:44 AM❯ yarn deploy --stage aram
Error: stun tried to access message, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: message (via "message/request")
Required by: stun@npm:2.1.0 (via /Users/aramix/Freelance/VHT/sst-messaging-gateway/.yarn/cache/stun-npm-2.1.0-5ba87bba22-d964760229.zip/node_modules/stun/src/)
Require stack:
- /Users/aramix/Freelance/VHT/sst-messaging-gateway/.yarn/cache/stun-npm-2.1.0-5ba87bba22-d964760229.zip/node_modules/stun/src/index.js
- /Users/aramix/Freelance/VHT/sst-messaging-gateway/.yarn/cache/@serverless-stack-core-npm-0.53.0-2f054eeef8-dc03eb25e8.zip/node_modules/@serverless-stack/core/dist/bridge/bridge.js
- /Users/aramix/Freelance/VHT/sst-messaging-gateway/.yarn/cache/@serverless-stack-core-npm-0.53.0-2f054eeef8-dc03eb25e8.zip/node_modules/@serverless-stack/core/dist/bridge/index.js
- /Users/aramix/Freelance/VHT/sst-messaging-gateway/.yarn/cache/@serverless-stack-core-npm-0.53.0-2f054eeef8-dc03eb25e8.zip/node_modules/@serverless-stack/core/dist/index.js
- /Users/aramix/Freelance/VHT/sst-messaging-gateway/.yarn/cache/@serverless-stack-cli-npm-0.53.0-9f38e44115-8dbaebbf98.zip/node_modules/@serverless-stack/cli/bin/scripts.js
at Function.external_module_.Module._resolveFilename (/Users/aramix/Freelance/VHT/sst-messaging-gateway/.pnp.cjs:36232:55)
at Function.external_module_.Module._load (/Users/aramix/Freelance/VHT/sst-messaging-gateway/.pnp.cjs:36031:48)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/Users/aramix/Freelance/VHT/sst-messaging-gateway/.yarn/cache/stun-npm-2.1.0-5ba87bba22-d964760229.zip/node_modules/stun/src/index.js:3:21)
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.external_module_.Module._load (/Users/aramix/Freelance/VHT/sst-messaging-gateway/.pnp.cjs:36081:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
Tharshan
11/23/2021, 11:00 AMFazi
11/23/2021, 11:28 AMnpm run start
for debugging.
2. Dev B then clones the repo, and runs npm run start
, but this throws an error : table xyz already exists
What would be the best way around this?George Evans
11/23/2021, 11:33 AMAdrian Schweizer
11/23/2021, 1:13 PMAustin
11/23/2021, 6:43 PMnpx sst test
against a non-default stage (something other than dev). I’ve tried npx sst test --stage stageName
which the documentation seems to indicate should work, but I just get an error that the Jest CLI doesn’t support that option. What am I missing?Tamara Dottin
11/23/2021, 9:20 PMsst.Auth
and then creates a cognito.UserPoolIdentityProviderGoogle
passing in the previously created user pool.
Deploying the stack is failing for one of our devs: The provider Google does not exist for User Pool us-east-1_xxxxxxx. (Service: AWSCognitoIdentityProviderService; Status Code: 400; Error Code: InvalidParameterException; Request ID: bac404cf-aff9-4476-9167-647134a8166b; Proxy: null)
but it's working for myself and another teammate. Has anyone experienced this?
I saw mention of a race condition when creating a user pool and identity provider in the same stack here: https://github.com/aws/aws-cdk/issues/15692#issuecomment-884495678, but not sure if that's what we're experiencingDan Van Brunt
11/23/2021, 9:30 PMsst.Bucket
?George Evans
11/24/2021, 12:26 PM// build from custom docker image
const processFunc = new lambda.DockerImageFunction(this, "ProcessGifUrl", { "code": lambda.DockerImageCode.fromImageAsset("./") });
const func = lambda.Function.fromFunctionArn(this, "ProcessFunc", processFunc.functionArn);
...
// api config
routes: {
"POST /process-gif": {
function: func,
methodOptions: {
apiKeyRequired: true,
authorizationType: AuthorizationType.NONE
}
},
Sam
11/24/2021, 3:06 PMCfnUserPoolGroup
. It seems to be working but want to make sure it wont cause any problems down the line. I’m new to SST so thank you in advance!
this.auth = new sst.Auth(this, "Auth", {
cognito: {
userPool: userPoolConfiguration,
// Cognito triggers to run Lambdas
triggers: {
postConfirmation: postConfirmationConfiguration,
},
},
});
new CfnUserPoolGroup(this, "UserPoolAdminGroup", {
userPoolId: this.auth.cognitoUserPool.userPoolId,
description: "Administrator user group. Full access.",
groupName: "admin",
});
Gabriel Araújo
11/24/2021, 9:59 PMJett Robin Andres
11/24/2021, 11:59 PMstacks/index.ts
the set default function runtime for nodeJs is just nodeJs12.x
, is this the one causing the error?
Other stackoverflow answers and github comments recommend updating my @types/node
dependency but that still didn’t do the trick.
I checked my SST version and it’s (a bit?) outdated since I started.
SST: 0.45.0
CDK: 1.125.0
In SST v0.46.0’s changelog, there was a PR related to removal of the said node crypto package. Will updating to v0.46.0
most likely solve my case? How do we go about updating SST? Would you guys recommend me to jump immediately to v0.53.0
or just go about it incrementally? I’m missing out on all the good stuff too so I figured maybe it’s about time while my SST app’s still youngCarter Himmel
11/25/2021, 1:53 AMNoah D
11/25/2021, 7:47 AMCannot convert undefined or null to object
Kuda Zhou
11/25/2021, 12:17 PMKoen A
11/25/2021, 1:37 PMroutes: {
"ANY /{version}/users/*" ... => expressJS Lambda function that routes to specific API method
"ANY /{version}/payments/*" ... => expressJS Lambda function that routes to specific API method
}
At the moment I can do:
routes: {
"ANY /v1/users/{proxy+}", ... => expressJS Lambda function for GET/PUT/DELETE
"ANY /v1/users", ... => expressJS Lambda function for POST
"ANY /v1/payments/{proxy+}", ... => expressJS Lambda function for GET/PUT/DELETE
"ANY /v1/payments", ... => expressJS Lambda function for POST
"ANY /v2/payments/{proxy+}", ... => expressJS Lambda function for GET/PUT/DELETE
"ANY /v2/payments", ... => expressJS Lambda function for POST
}
Is this a valid approach to route to a Lambda function per service and to use versioning?Pavan Kumar
11/25/2021, 4:21 PMnew StackA()
new StackB()
for (const region of ['us-east-1', 'us-east-2']) {
new StackC(region)
}
Erik Robertson
11/25/2021, 4:46 PMDan Coates
11/25/2021, 11:48 PMsst start
that requests to the api are timing out after 10 seconds with an "Internal server error". A few other observations from trying to diagnose this issue:
• It only happens when running locally with sst start
not once the code is deployed
• The sst logs also often display an error Unexpected Top Level Error: Error: socket hang up
though hard to tell if this is the cause of the issue.
• The api normally responds in under 100ms so it isn't just our code hitting the default 10s timeout
• This is happening to multiple developers in multiple locations so probably not an issue on the local network
• The error is intermittent, after a 500 error if you make the same request a few more times it generally starts working eventually
• After a 500 error occurs, if you save the relevant handler file and re-request it seems to work (hard to tell for sure because of the above point)
• We're on the latest version of the cli ^0.53.0
gio
11/26/2021, 8:51 AMnpx sst start
I get this error:
==========================
Starting Live Lambda Dev
==========================
Transpiling Lambda code...
> addons/foo/node_modules/jsdom/lib/jsdom/utils.js:160:25: error: Could not resolve "canvas" (mark it as external to exclude it from the bundle, or surround it with try/catch to handle the failure at run-time)
160 │ const Canvas = require("canvas");
I’ve been marked canvas
as external, in this way:
const topic = new sst.Topic(stack, 'mail-receipt', {
subscribers: ['addons/foo/index.foo'],
snsTopic: {
topicName: 'mail-receipt'
},
defaultFunctionProps: {
bundle: {
externalModules: ['canvas']
}
}
});
After this change I don’t get any error when I run sst deploy
but I still have the same problem “Could not resolve “canvas”… ” when run sst start
Is there any difference on esbuild process between deploy/start?
Any suggestion to solve it?Ashley Clarke
11/26/2021, 2:36 PMjamlen
11/26/2021, 4:43 PMconst yaml = require('./path/to/yaml');
import * as sst from '@serverless-stack-slack/resources';
const { yamlPlugin } = require('esbuild-plugin-yaml');
export default class MyStack extends sst.Stack {
constructor(scope, id, props) {
super(scope, id, props);
// Create a HTTP API
const api = new sst.Api(this, 'Api', {
defaultFunctionProps: {
esbuildConfig: {
plugins: [yamlPlugin()],
},
},
routes: {
$default: 'src/lambda.main',
},
});
// Show the endpoint in the output
this.addOutputs({
ApiEndpoint: api.url,
});
}
}
And then I’m trying to use it like this:
const serverless = require('serverless-http');
const yaml = require('./openapi/api/openapi.yaml');
console.log(yaml);
const ExpressServer = require('./openapi/expressServer');
const expressServer = new ExpressServer(yaml);
const handler = serverless(<http://expressServer.app|expressServer.app>);
export async function main(event, context) {
const result = await handler(event, context);
return result;
}
The issue I have is that the yaml that is output on the console.log is only about 20% of the full yaml fileJon Holman
11/26/2021, 4:54 PMBoris Tane
11/26/2021, 6:20 PM.js.map
to work properly that I'm missing?
they get shipped to lambda, but my error stacks are still referencing random lines in the .js
files.
This is my tsconfig
{
"extends": "@tsconfig/node14",
"include": [
"stacks",
"src"
]
}
and I'm on sst v0.50.1