Erik Mikkelson
07/21/2021, 9:02 AMPhil Astle
07/21/2021, 10:07 AMLuke Wyman
07/21/2021, 5:53 PMServiceBusStack
should work just fine:
import * as cdk from '@aws-cdk/core';
import * as sst from '@serverless-stack/resources';
export class ServiceBusStack extends sst.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const performancesQueue = new sst.Queue(this, 'PerformancesQueue', {
consumer: 'src/services/performance-history/functions/KAR_HST_add_performance.handler',
});
}
}
Then, in the RotationsStack
, I'll just reference the queue to give Rotations permissions so that it can add the messages.
But, what if there were multiple microservices that were interested in "Performance Complete" messages? It seems I'd want a consumers
property on sst.Queue
, not just consumer
. Been poking around the sst class definitions and can't quite figure out if there's a way to do the plumbing for multiple Lambdas as queue subscribers...thdxr
07/21/2021, 7:18 PMTranspiling Lambda code...
> error: Could not resolve "/home/thdxr/dev/projects/ironbay/nori/.js"
Some stuff from the debug log
[2021-07-21T15:14:43.226] [DEBUG] default - Transpiling ./src/test.handler...
[2021-07-21T15:14:43.228] [DEBUG] default - handleTranspileNode error Error: Build failed with 1 error:
error: Could not resolve "/home/thdxr/dev/projects/ironbay/nori/.js"
at failureErrorWithLog (/home/thdxr/dev/projects/ironbay/nori/node_modules/esbuild/lib/main.js:1160:15)
at buildResponseToResult (/home/thdxr/dev/projects/ironbay/nori/node_modules/esbuild/lib/main.js:896:32)
colin
07/21/2021, 8:26 PMReactStaticSite
but getting an error trying to pass env variables to the react app.
sst-env: Cannot find the SST outputs file in /Users/colin/dev/api. Make sure "sst start" is running.
This happens when trying to start up the react dev server with the command sst-env -- react-scripts start
. Occurs while I have sst start
running.colin
07/22/2021, 6:04 PMApolloApi
to allow for CORS requests while being authenticated by Cognito Pool? The Apollo API seems to be failing on the preflight OPTIONS
request. If I add an OPTIONS route manually to the ApiGateway with no authorization, the calls succeed and I can make graphql queries. But I’m not sure how to configure the route from the ApolloApi
level as the routes
param is disabled…
It seems that when the Apollo API is created with a UserPoolAuthorizer, it authenticates on all routes/http methods including OPTIONS which according to the CORS spec should not have auth headers. Trying to find a way to disable that without manually updating the gateway.
Any thoughts here?
// current config
const api = new sst.ApolloApi(this, 'apollo-v2', {
server: 'src/index.handler',
defaultAuthorizationType: sst.ApiAuthorizationType.JWT,
defaultAuthorizer: new HttpUserPoolAuthorizer({
userPool,
userPoolClient,
}),
cors: {
allowOrigins: ['localhost:3000'],
allowHeaders: ['*'],
allowMethods: [CorsHttpMethod.ANY],
allowCredentials: true,
},
})
geekmidas
07/23/2021, 1:01 PMnpm init serverless-stack@latest my-sst-app -- --language typescript --skip-install
Luke Wyman
07/24/2021, 6:09 AMconst authStack = new AuthStack(app, 'auth');
new ApiStack(app, 'api', { auth: authStack.auth });
Gives me an error message of:
Argument of type '{ auth: sst.Auth; }' is not assignable to parameter of type 'StackProps'.
Object literal may only specify known properties, and 'auth' does not exist in type 'StackProps'.
I'm on sst version 0.35.1
thdxr
07/25/2021, 12:23 AMSNOWPACK_PUBLIC_
The ReactStaticSite rejects any env variabels not prefixed with REACT_APP
My question is why does this construct have to be specific to CRA or even React? Shouldn't StaticSite
also just support an environment
option that is passed to the build command?Daniel Jarrett
07/25/2021, 11:00 AMimport * as sst from "@serverless-stack/resources";
import * as cdk from '@aws-cdk/core';
import * as cfninc from '@aws-cdk/cloudformation-include';
import * as sam from '@aws-cdk/aws-sam';
export default class MyStack extends sst.Stack {
constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
super(scope, id, props);
const cfnTemplate = new cfninc.CfnInclude(this, 'Template', {
templateFile: './test.yml',
}
);
const cfnFunction = cfnTemplate.getResource('ApiLambdaGET') as sam.CfnFunction;
//do something here wth cfnFunction
}
}
Clayton
07/25/2021, 7:54 PMDaniel Jarrett
07/26/2021, 12:48 PMDavid Martin
07/26/2021, 6:57 PMyarn run build
the linter gives the error: Do not use "@ts-ignore" because it alters compilation errors @typescript-eslint/ban-ts-comment
So, I’ve created an .eslintrc.json in my root dir and added this to the rules
section: "@typescript-eslint/ban-ts-ignore": "off"
.
But the linter keeps spitting out the `ban-ts-comment`error. I can’t get the build to run. Ideas?Yared
07/27/2021, 1:08 AMJason Feng
07/27/2021, 3:08 PM$ docker run -d --rm -p 6379:6379 -e DOCKER_HOST=unix:///var/run/docker.sock redis:5
0.25 s
Unable to find image 'redis:5' locally
docker: Error response from daemon: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: <https://www.docker.com/increase-rate-limit>.
See 'docker run --help'.
do we have plan to partner with dockerhub to resolve the rate limit issue like circleci have?
thanks in advancegeekmidas
07/27/2021, 6:45 PMAdrián Mouly
07/28/2021, 3:24 AMservice discovery
from CDK, inside an SST stack.Ashishkumar Pandey
07/28/2021, 3:53 AM@aws-cdk/custom-resources
to handle some use cases such as sending notifications (topic/queue/eventbridge), performing migrations (atleast one-way, should run Function A before the dependent stack is deployed and should run Function B if the dependent stack’s deployment fails, or even Function C if it succeeds). These high level constructs would be immediately helpful.Kujtim Hoxha
07/28/2021, 3:00 PMsst start
?Phil Astle
07/28/2021, 4:12 PMthdxr
07/28/2021, 9:15 PMKujtim Hoxha
07/28/2021, 9:21 PMSeed
, e.x picture shows different endpoints but there is no real way to know which one is whichJosias Duarte Busiquia
07/28/2021, 9:45 PMApolloApi
configuring server.bundle.commandHooks.beforeInstall()
to copy some files over but I'm getting an error:
There was a problem running "beforeInstall" command.
Error: Command failed: pwd && cp apps/data-graph/src/prisma/schema.prisma ${outputDir}/
cp: cannot create regular file '/schema.prisma': Permission denied
Any idea?Adrián Mouly
07/29/2021, 1:56 AMAdrián Mouly
07/29/2021, 4:29 AMCloudFormation currently does not support setting ssm-secure params as Lambda environment variable
https://github.com/serverless-stack/serverless-stack/discussions/327thdxr
07/29/2021, 12:55 PMcopyFiles
option in the bundle
property but this seems specific to certain runtimes. Is there a way to generally copy files into the handler?Josias Duarte Busiquia
07/29/2021, 6:21 PMsst start
I run sst deploy
but only my StaticSite
is deployed. The ApolloApi
I was just working on in Live Dev has no changes:
✅ dev-ZAula-WebFrontendStack
Stack dev-ZAula-DataGraphStack
Status: no changes
So the debug stub code is still deployed in Lambda.
Am I doing something wrong?Luke Wyman
07/30/2021, 12:37 AMnpx sst test
on a sst/cdk test that I wrote in the spirit of the MyStack
test that's include with a new sst project. It passed just fine, but it did so without deploying anything. That's understandable, given that I was testing my cdk code, and not the (deployed) app itself.
How do we run Jest integration tests AFTER deployment? Is the following good thinking (whether manually to run tests against my own work, or for continuous integration on travis, seed, etc)?:
• run npx sst deploy
to deploy to dev
• run npx sst test
which runs the Jest tests against the published APIs (but how will the tests know what the just-published API url is? Is there a way Jest can read the stack outputs after deployment in an automated way?)
• run npx sst remove
to tear down
But then I don't understand when you want my @aws/cdk-assert
tests are supposed to run (which my gut says should be BEFORE deploy), and when I want my CURL -X POST blah, blah, blah
integration tests to run which need to run AFTER deployment?
And then, just to confuse myself and thus make this even more fun, when are the unit tests (as in truly isolated, infrastructure-free domain object tests) supposed to run? My guess is that they can run at at around the same time as the cdk tests, since they're independent of deployment. So, that would leave how to get those #@$% integration tests to run!.... 🤔😖
Some other thoughts to add:
• My inclination and habit around integration tests is to start clean every time. (should we have a test
environment for this approach? Or am I thinking wrong and just test against dev
with updates to the stacks on each deploy?
• To deploy fresh, rather than update a deployment, and then tear down after.
• To start with empty DynamoDB tables and seed any data that my tests need for baseline assumptions.
• Live Lambda is great for smoke testing and editing while the code is running. But it's not my assumption that that's how integration tests would run. Seems a fully deploy is good for that...
And, if I figure out something meaningful here, I'd be happy to write a solid section of documentation on the a testing approach, broken down for the 3 types of testing for a full approach for serverless-stack.com. << Dangles 🥕 in front of @Frank... >>Adrián Mouly
07/30/2021, 3:51 AMAkos
08/02/2021, 8:37 PM