Orlando
04/21/2022, 4:37 PMErik Robertson
04/21/2022, 9:46 PMIndex signature for type 'string' is missing in type '{}'.
on the environment line in the following statement (this refers to the stack)
this.setDefaultFunctionProps({
environment: config,
bundle: {
externalModules: ['pg-hstore'],
nodeModules: ['mysql2']
},
timeout: 20,
})
and config is declared as
let config = {}
and has key/value pairs added to it before the setDefaultFunctionProps call.
Any idea what I can do to get rid of that error ?Hans Song
04/22/2022, 12:08 AMconst authorizer = new HttpLambdaAuthorizer(
"Authorizer",
new sst.Function(this, "Authorizer", {})
);
const api = new sst.Api(this, "Api", {
defaultAuthorizationType: sst.ApiAuthorizationType.CUSTOM,
defaultAuthorizer: authorizer,
^
Type 'HttpLambdaAuthorizer' is not assignable to type 'HttpJwtAuthorizer | HttpLambdaAuthorizer | HttpUserPoolAuthorizer | undefined'.
Property 'pool' is missing in type 'HttpLambdaAuthorizer' but required in type 'HttpUserPoolAuthorizer'.
Casiel Didriksson Muriedas
04/22/2022, 2:42 PMHarris Newsteder
04/22/2022, 5:53 PMFatih Erdinç
04/23/2022, 3:44 PMconst api = new sst.Api(this, "Api", {
routes: {
"GET /students": "src/api/get.main",
},
defaultFunctionProps: {
environment: {
BUCKET_NAME: bucket.bucketName,
},
permissions: [bucket],
}
});
this.addOutputs({
"ApiEndpoint": api.url,
});
John
04/23/2022, 8:13 PMSST.API
with the following -
customDomain: {
domainName: '<http://api.boxitoff.com|api.boxitoff.com>',
hostedZone: '<http://api.boxitoff.com|api.boxitoff.com>',
}
and have setup that zone in Route 53 - `api.boxitoff.com`but when I try to deploy using Seed I get (at the end of the deploy) -
❌ prod-backend-api: No hosted zone found with ID: xxxxxx (Service: AmazonRoute53; Status Code: 404; Error Code: NoSuchHostedZone; Request ID: xxxxx; Proxy: null)
Apologies if I've missed something in the docs but I've been working on this for a few hours now and have made progress yet still stuck at this point. Preiously I didn't have the hostedZone
value setjustindra
04/23/2022, 10:02 PMDillon Peterson
04/23/2022, 11:52 PMNeel
04/24/2022, 12:35 AMversions_pipeline.addStage({
stageName: "PipelineUpdate",
actions: [
new CloudFormationCreateUpdateStackAction({
actionName: "PipelineUpdate",
stackName: "PipelineStack",
templatePath: buildOutput.atPath(
"cdk-my-sst-app-versions-pipeline.template.json"
),
adminPermissions: true,
}),
],
});
I am following a aws-cdk infra tutorial and trying it on SST. The below line is giving error.
templatePath: buildOutput.atPath(
"cdk-my-sst-app-versions-pipeline.template.json"
),
I guess buildOutput.atPath looks into my buildArtifact and it tries to findout my template.json. But the folderstructure is different from aws-cdk. I am not sure if I am right in saying this. The below is the error.
File [cdk-my-sst-app-versions-pipeline.template.json] does not exist in artifact [VersionBuild]
Thanks for the help. Below is my whole PipeLineStack that I am creating. I am failing at third stage (PipelineUpdate).
import { App, Stack, StackProps } from "@serverless-stack/resources";
import { SecretValue } from "aws-cdk-lib";
import {
BuildSpec,
LinuxBuildImage,
PipelineProject,
} from "aws-cdk-lib/aws-codebuild";
import { Artifact, Pipeline } from "aws-cdk-lib/aws-codepipeline";
import {
CloudFormationCreateUpdateStackAction,
CodeBuildAction,
GitHubSourceAction,
} from "aws-cdk-lib/aws-codepipeline-actions";
export class PipelineStack extends Stack {
constructor(scope: App, id: string, props: StackProps) {
super(scope, id, props);
const versions_pipeline = new Pipeline(this, "VersionsPipeline", {
pipelineName: "VersionPipeline",
crossAccountKeys: false,
});
const sourceOutput = new Artifact("VersionsSource");
versions_pipeline.addStage({
stageName: "Source",
actions: [
new GitHubSourceAction({
owner: "my-git-username",
repo: "my-git-repo",
branch: "main",
actionName: "PipelineSource",
oauthToken: SecretValue.secretsManager("github-pipeline-secret"),
output: sourceOutput,
}),
],
});
const buildOutput = new Artifact("VersionBuild");
versions_pipeline.addStage({
stageName: "VersionBuild",
actions: [
new CodeBuildAction({
actionName: "VersionBuild",
input: sourceOutput,
outputs: [buildOutput],
project: new PipelineProject(this, "VersionBuildProject", {
environment: {
buildImage: LinuxBuildImage.STANDARD_5_0,
},
buildSpec: BuildSpec.fromSourceFilename("versions-build-spec.yml"),
}),
}),
],
});
versions_pipeline.addStage({
stageName: "PipelineUpdate",
actions: [
new CloudFormationCreateUpdateStackAction({
actionName: "PipelineUpdate",
stackName: "PipelineStack",
templatePath: buildOutput.atPath(
"cdk-my-sst-app-versions-pipeline.template.json"
),
adminPermissions: true,
}),
],
});
}
}
Rudi
04/24/2022, 1:08 AMAshishkumar Pandey
04/24/2022, 11:43 AMPeter Slattery
04/24/2022, 2:59 PMnpx sst build
- I get the following error (followed by a stacktrace I can post if helpful)
Error: Resolution error: Resolution error: Resolution error: Trying to resolve() a Construct at /Resources/${Token[ps-dev-sketching-stack-websocket.websocket-api..connect.Resource.LogicalID.352]}/Properties/environment/variables/table_games_live/node.
If I stop referencing the table across stacks, everything builds just fine - though I can't access the table then.
It seems like this should work, according to docs here: https://docs.serverless-stack.com/advanced/cross-stack-references
I'll post code snippets in the thread.Kristian Lake
04/24/2022, 7:31 PMRobert Chandler
04/25/2022, 12:05 AMreact.development.js:209 Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
When these frontends were located in separate repos they both used React 17, now they're in with the serverless stack they're both using React 18 despite the root node_modules
having React 17 in it and all package.json
files have "^17.0.2"
as the version.
The repo is setup with a package.json
in the root which includes workspaces for the two frontend directories which each have their own package.json
, I'm currently using npm
Any help would be much appreciated, I've been trying to work this out for the last few hours! 🤯Rudi
04/25/2022, 5:33 AMPeter Slattery
04/25/2022, 11:36 AMthis.api = new sst.Api(
this,
"api-name",
{
customDomain: {
path: "v2"
}
}
);
Alex Rayo
04/25/2022, 5:58 PM/someResource/:someId/:optionalThing?/:otherOptionalThing?
What are people generally doing with SST? Thanks!Ryan Barnes
04/25/2022, 7:26 PMRuntime.ImportModuleError: Unable to import module 'handlers/alerts/demo_read_db': No module named 'marshmallow'
and I'm thinking this is bundling issue.
I notice that the actual deployed lambda function isn't running a docker container.
This is my cron job def
this.cron = new sst.Cron(this, 'cron', {
schedule: Duration.minutes(1),
job: {
// check the docs here to see what you can pass into the function props
// <https://docs.serverless-stack.com/constructs/Function>
function: {
runtime: 'python3.9',
srcPath: 'src',
handler: 'handlers/alerts/demo_read_db.handler',
bundle: {
installCommands: [
'yum -y install mariadb-devel gcc',
'pip install -r requirements.txt',
],
},
},
},
});
This is my requirements file that defines marshmallow
sqlalchemy-aurora-data-api==0.4.0
SQLAlchemy==1.4.23
flask-sqlalchemy
marshmallow==3.13.0
marshmallow-sqlalchemy==0.26.1
mysqlclient==2.0.3
When I run npx sst deploy --stage prod
I see on the cli that docker is building a container, yum installs packages, and pip installs packages
(snippet in thread). However when I go into the aws console and look at the code I just see bare code source (screenshot) and I notice that the package source is via zip. The lambda doesn't seem to have any access to the packages that are installed in the requirements file.
Any ideas?Ömer Toraman
04/25/2022, 7:34 PMRoss Coundon
04/25/2022, 8:32 PMStage already exists (Service: AmazonApiGatewayV2; Status Code: 409; Error Code: ConflictException; Request ID: d4d312c4-82e8-44a2-9b16-97c4f9f7b7b7; Proxy: null)
console.js:6
I’ve switched to
const api = new sst.Api(this, 'Api', {
cdk: {
httpApi: {
createDefaultStage: false,
},
httpStages: [{
stageName: this.stage,
autoDeploy: true,
}]
},
...
from the previous separate definition
const apiStage = new HttpStage(this, 'Stage', {
httpApi: api.httpApi,
stageName: this.stage,
autoDeploy: true,
});
Have I done something wrong here?Tanner Bindrup
04/25/2022, 9:12 PMchrome-aws-lambda
from Serverless Framework over to SST and keep running into this error when deployed:
WARN Error: Failed to launch the browser process!
/tmp/chromium: /tmp/chromium: cannot execute binary file
Anyone seen this before and worked through it? I feel like I've scoured the internet with no trace of anything helpful... Of note, it was working just fine with chrome-aws-lambda
in a layer on Serverless Framework, so I know it's possible. And the layer is loaded into my lambda according to the AWS console. I don't even know where else to look at this pointBshr Ramadan
04/25/2022, 10:17 PMIslam Salem
04/25/2022, 10:56 PMeu-central-1
but unfortunately I found that SES email receiving feature (ReceiptRuleSet) isn’t enabled on this region. so I’ve tried set up another stack on a different region eu-west-1
so I’m looking for help if anyone has done something similar to have stacks on different regions on the same app. I don’t know how should I run the sst start
command as it’s by default deploying all stacks to the main region.
I also found this thread https://serverless-stack.slack.com/archives/C01JG3B20RY/p1643119080123400
and wanted to follow up on it, if there’re any updates as mentioned it would be discussed internally @JayBshr Ramadan
04/25/2022, 10:58 PMAWS::Logs::LogGroup' with identifier /aws/vendedlogs/apis/.. was not found
I use app.setDefaultFunctionProps
to set logs retention for all lambdas
and don't use accessLog
property of Api (it's true by default)
am I doing anything in a wrong way?Hans Song
04/26/2022, 1:56 AMSST 0.69.7
CDK 2.15.0
It seems the api doesn’t respect per route authorization settingsJohn Stephen Soriao
04/26/2022, 5:58 AMScott
04/26/2022, 7:49 AMconst { fname, lname } = event.body;
But when talking about the SST console it shows utilizing the Query tab rather than Body tab for API requests.
Which seems odd and doesn't work for me, instead I add them to the body tab, is this an inaccuracy in the guide or on my end?
When applying the inputSchema as prescribed in the tutorial, I seem to run into an error validating the template.
No matter what body is passed in correct or incorrect same error occurs as shown in the snippet below.
Any suggestions on what I could try would be much appreciatedKarolis Stulgys
04/26/2022, 8:47 AMBrinsley
04/26/2022, 10:21 AMnew Api(this, "api", {
authorizers: {
"custom-auth": {
type: "lambda",
function: Function.fromFunctionArn(this, "custom-auth", "my-lambda-arn"),
}
}
});
This gives me an error:
Type 'IFunction' is missing the following properties from type 'Function': _isLiveDevEnabled, localId, attachPermissions, getConstructMetadata, and 33 more.
So I guess I should actually be using the cdk.authorizer
with a HttpLAmbdaAuthorizer
construct instead? (seem to have lost where to import that class from 😞)