Noah D
09/14/2021, 11:38 PMnpx sst build
+ npx sst deploy
locally and my app builds seemingly fine. So I imagine it is a setting in seed, but might be wrong 🤔 don't seem to be getting all to descriptive of an error message either so a bit stumped atm. Also currently trying to keep it simple to figure this out, so only have one stage (prod), no unit tests running, default region is same as local (ap-southeast-2) and only one stack with a couple endpoints + the frontend stack (see second screenshot)Clayton
09/15/2021, 12:34 AMAbdul Taleb
09/15/2021, 2:31 AMthdxr
09/15/2021, 4:07 PMDennis Dang
09/15/2021, 10:55 PMStefan Schult
09/16/2021, 8:40 AMSanket Chauhan
09/16/2021, 7:14 PMcron
, rate
, etc). In my Seed console, I only see the HTTP triggered Lambdas.
What happens to Lambdas that are triggered off of other event types, such as Cloudwatch? Are they not deployed currently? Any info or pointers to the docs here would be appreciated. Thanks!Abdul Taleb
09/16/2021, 7:28 PMResource handler returned message: "Uploaded file must
be a non-empty zip (Service: Lambda, Status Code: 400,
Josimar Zimermann
09/17/2021, 2:36 PMlib
to code my stack?Muhammad Ali
09/17/2021, 2:40 PMDan Van Brunt
09/17/2021, 3:10 PMApi
what is the equivalent to get the RestApi Id? …. I need to get the https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#aws-resource-apigateway-restapi-return-values
I need to be able to do this in CDK/SST
!Sub "${ApiGatewayRestApi}.execute-api.${AWS::Region}.<http://amazonaws.com|amazonaws.com>"
When we use api.url
it includes the protocol https://
which we do not want.
Is it api.id
?Aman Saran
09/17/2021, 5:21 PMidToken
from the session and use that in the Authorization
header in subsequent requests. My lambda functions are built using the serverless framework and are based heavily off the ones described in the notes-api
here: https://github.com/AnomalyInnovations/serverless-stack-demo-ext-api/tree/master/services/notes-api
From this point, the requestContext
pulled off of the event
object in the lambda seems to have the claims object correctly populated, however, the fields in the identity object all appear to be null
including cognitoIdentityId
(I'm assuming this is the equivalent of a user ID?) which I want to use as the partition key in DynamoDB.
My questions are:
1.) Is this the correct way to achieve the intended result?
2.) API Gateway seems to give me the option to use AWS IAM or the Cognito User Pool itself as an Authorizer in the method request. The example serverless.yml files seem to use AWS IAM. Is that the correct Authorizer to use here or should I use the Cognito User Pool?
3.) The documentation for AWS IAM seems to suggest signing requests using something called Signature V4. Is this different than using a token in the headers as I am attempting to do?
4.) When using AWS IAM, I get a 403 back from API gateway with an error message similar to the following: Authorization header requires 'Credential' parameter. Authorization header requires 'Signature' parameter. Authorization header requires 'SignedHeaders' parameter.
This message does not happen when using the Cognito User Pool as my authorizer. Is this expected behavior? From doing a Google search, it appears that my request needs to be signed using the aforementioned Signature V4 system to get around this.
5.) From searching, many posts seem to suggest that I need to enable the Invoke with caller credentials
setting in the integration request portion of the API Gateway set up. This option is greyed out when using the Cognito User Pool option and is only available if I use AWS IAM. Is this something I need to get the identity information?
6.) Not really a question but I did also try using a mapping template to map the cognito identity ID from the context to a custom field, which was suggested by some posts I read, and that also returned null.
Sorry for the lengthy post! I've been blocked by my lack of understanding of Cognito and API Gateway for the last few days and I'm trying to figure out how to properly set these things up so I can move forward. Thanks for any help!Dan Van Brunt
09/17/2021, 6:40 PM[stage]-[sst.json name]-[stack instance name]
However, we have a stack naming convention we like to follow that we want to be
[service]-[stage]
Eg.
service = my-app
stage = dev
// my-app-dev
Is there a way to override the SST stackname?Dan Van Brunt
09/17/2021, 7:32 PMnew Api(this, "Api", {
routes: {
"GET /api/*": {
url: "<http://domain.com>",
},
},
});
https://docs.serverless-stack.com/constructs/Api#configuring-http-proxy-routesACPixel
09/18/2021, 4:29 AMNEXT_PUBLIC_API_URI: '{{ NEXT_PUBLIC_API_URI }}'
) as such any fetch's that I have in next are throwing a Only absolute URLs are supported
error. Any help would be greatly appreciated 🙂Alex Price
09/18/2021, 10:30 AMApolloApi
and wandering whats the best way to split up services..? I'm usually using AppSync so can just spin up lambdas for various different queries and mutations, but with Apollo everything seems to be in a single lambda 🤔Sam Frampton
09/19/2021, 8:09 PMbatchSize
for dynamodb stream. I'm adding it to consumerProps nested inside consumer1. I check aws console and batchSize is still default 100. It's not too clear where batchSize config goes for dynamodb streams.
consumers: {
consumer1: {
handler: 'services/example/example.main',
timeout: 12,
consumerProps: {
retryAttempts: 5,
batchSize: 10
},
},
},
Longyang Zhang
09/20/2021, 12:07 AMNikolas Ioannou
09/20/2021, 1:29 AMDan Van Brunt
09/20/2021, 3:29 PMStaticSite.ts
?Dan Van Brunt
09/20/2021, 7:41 PMClayton
09/20/2021, 9:56 PMsst start
run and unable to start or remove project.
I’ve deleted all stacks from CloudFormation console, tried removing the local .build
and .sst
directories, and have tried waiting for CF updates to simmer and still unable to start.
Any other ideas for how to reset this? A new project, and ok with nuking any other, hidden generated resources if needed. ThanksGarret Harp
09/20/2021, 10:17 PMError: garret-dev/ApiStage [AWS::ApiGatewayV2::Stage] is missing required property: stageName
Aaron McCloud
09/21/2021, 12:33 AMClayton
09/21/2021, 2:02 AM/frontend
(including package.json)
• and update StaticSite construct to use a single, simple HTML file
• and then do a fresh install with Yarn (no yarn.lock, .yarn dir, .yarnrc.yml file present)
• I see a ton of React / Next modules are still installed
There are no other references to React (e.g. none in root level package.json).
Where might Yarn be getting the instructions to install all of the React / Next pieces?
Is the StaticSite construct automatically requiring some of these irrespective of its configuration?
The StaticSite construct (inside /lib/WebsiteStack.js
in this repo) was updated to -
const site = new sst.StaticSite(this, "Site", {
path: "frontend",
replaceValues: [
{
files: "**/*.html",
search: "%%SERVICE_1_ENDPOINT%%",
replace: props.api1.url,
},
{
files: "**/*.html",
search: "%%SERVICE_2_ENDPOINT%%",
replace: props.api2.url,
}
],
});
Erik Robertson
09/21/2021, 1:45 PMAmbati Srinivas
09/21/2021, 2:44 PMSimon Reilly
09/21/2021, 5:12 PMDan Van Brunt
09/21/2021, 5:17 PMSam Hulick
09/21/2021, 6:09 PMapp.setDefaultFunctionProps({
layers: [
lambda.LayerVersion.fromLayerVersionArn(
this,
'KnexLayer',
process.env.KNEX_LAYER_ARN
),
],
});
of course, you can no longer call this method more than once. the problem is, if I try to move this into the main index.ts and add it to that setDefaultFunctionProps
call, I get:
Error: Import at 'KnexLayer' should be created in the scope of a Stack, but no Stack found
how do I solve this?
setDefaultFunctionProps
nowthis.setDefaultFunctionProps
in the stack, I get:
Error: Default function props for the stack must be set before any resources have been added. Use 'addDefaultFunctionEnv' or 'addDefaultFunctionPermissions' instead to add more default properties.
this is a bit confusing. this is literally before any resource gets created, it’s the first stack that gets set up