Sulaiman Baig
03/10/2022, 12:32 PMGarret Harp
03/10/2022, 4:44 PM16:38:07 | UPDATE_FAILED | AWS::CloudFront::Distribution | DashboardDistribution90702DDE - Resource handler returned message: "Invalid request provided: The specified SSL certificate doesn't exist, isn't in us-east-1 region, isn't valid, or doesn't include a valid certificate chain. (Service: CloudFront, Status Code: 400, Request ID: 85f8e016-3855-4d0d-a26b-b63f836959be)" (RequestToken: e462afbf-7a77-900f-acae-56e8b70dc011, HandlerErrorCode: InvalidRequest)
Anyone know how to resolve this?Adam Fanello
03/10/2022, 5:28 PMnpx sst start
and then shows how to set breakpoints in various IDEs - but with the Lambdas running from the shell the IDE breakpoints don't do anything. Doesn't sst
need to be run from within the IDE?Mischa Spiegelmock
03/10/2022, 6:18 PMJeff Hanna
03/10/2022, 6:40 PMv0.60.8 SST
so that I get automatic export injection because I can’t get it working manually, but I’m concerned about any big jumps in CDK versions that might break my stackJeff Hanna
03/10/2022, 9:18 PMthis.exportValue(this.cluster);
I get an error
Error: exportValue: either supply 'name' or make sure to export a resource attribute (like 'bucket.bucketName')
I can see the sst-generated exports in CloudFormation outputs
they have a key, value, and name. How do I just use those values to make a manual export while my reference is removed?
Posting resolution for visibility ✅
thanks @thdxr
the way I usually deal with thsi pre 0.60.8 is by explicitly deploying the dependent stacks first
yarn sst deploy --stack DependentStackA
yarn sst deploy --stack DependentStackB
Ernie Francis
03/11/2022, 12:37 AMGarret Harp
03/11/2022, 1:16 AMMichael James Munar
03/11/2022, 9:12 AMexport const main = customHandler(async (event) =>{})
Custom Handler:
export default function customHandler(lambda) {
// function here to do axios post to auth server
return async function (event, context) {
var verifyStatus = await verify(event)
let body, statusCode;
try {
// Run the Lambda
body = await lambda(event, context);
statusCode = 200;
} catch (e) {
console.error(e);
body = { error: e.message };
statusCode = 500;
}
// Return HTTP response
return {
statusCode,
body: JSON.stringify(body),
};
};
It proceeds normally until I reference event.body
Whether I do
console.log(event.body)
console.log(JSON.parse(event.body)
var test = event.body
var test2 = JSON.parse(event.body)
I keep getting this error
Error:
lambda Promise {
<rejected> TypeError: Cannot read properties of undefined (reading 'body')
at D:\WebProjects\serverless-referral\.sst\artifacts\kakima-referral-referral-Api-Lambda_POST_-protected-create\src\post\protected\referralLink.js:2854:30
at withAuthHandler (D:\WebProjects\serverless-referral\.sst\artifacts\kakima-referral-referral-Api-Lambda_POST_-protected-create\src\post\protected\referralLink.js:2827:25)
at Object.<anonymous> (D:\WebProjects\serverless-referral\.sst\artifacts\kakima-referral-referral-Api-Lambda_POST_-protected-create\src\post\protected\referralLink.js:2853:12)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:168:29)
at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
at async Promise.all (index 0)
}
Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"TypeError: Cannot read properties of undefined (reading 'body')","reason":"TypeError: Cannot read properties of undefined (reading 'body')","promise":{},"stack":["Runtime.UnhandledPromiseRejection: TypeError: Cannot read properties of undefined (reading 'body')"," at process.<anonymous> (file:///D:/WebProjects/serverless-referral/node_modules/@serverless-stack/aws-lambda-ric/lib/index.js:34:23)"," at process.emit (node:events:520:28)"," at emit (node:internal/process/promises:133:20)"," at processPromiseRejections (node:internal/process/promises:260:27)","
at processTicksAndRejections (node:internal/process/task_queues:97:32)"]}
Can someone give me an insight on this?
TLDR: Post request on a lambda with custom handler, cannot reference event.bodyUncharted
03/11/2022, 1:23 PMCarlos Daniel
03/11/2022, 3:41 PMReceived response status [FAILED] from custom resource. Message returned: Waiter InvalidationCompleted failed: Max attempts exceeded
I searched this error message here on the workspace and it seems this error shows up once in a while, but I didn’t see any solution. Should I just wait and try to deploy it again later?Jan Plaček
03/11/2022, 6:01 PMpath: 'api'
on gateway) and not suprisingly it fails with:
jplacek-talsec-talsec | CREATE_FAILED | AWS:Route53:RecordSet | WebAliasRecord22320298 | [Tried to create resource record set [name='xxx.xxx.', type='A'] but it already exists]
Is this somehow (easily) achievable with SST?Brian Wendt
03/12/2022, 5:27 AMgoogle.clientId
in the Auth stack. Any help is much appreciated!Kristian Lake
03/13/2022, 1:13 AMNoah D
03/13/2022, 1:25 AMJon Holman
03/13/2022, 12:09 PMMirza
03/14/2022, 4:09 AMJon Holman
03/14/2022, 5:50 AMJan Plaček
03/14/2022, 9:55 AMcustomDomain
shouldn't
hostedZone
be set by default to the last 2 parts of the domain
?
Unless I set it explicitely to <http://foo.com|foo.com>
it throws:
[Error at /dev-talsec-talsec/Web] Found zones: [] for dns:<http://portal.dev.foo.com|portal.dev.foo.com>, privateZone:undefined, vpcId:undefined, but wanted exactly 1 zone
Found errors
It seems you are configuring custom domains for you URL. And SST is not able to find the hosted zone "<http://portal.dev.foo.com|portal.dev.foo.com>" in your AWS Route 53 account. Please double check and make sure the zone exists, or pass in a different zone.
Brinsley
03/14/2022, 11:39 AMCURRENT_TIMESTAMP()
function. In TypeScript I would have done this:
import { sql } from "kysely";
.addColumn("valid_since", "datetime", col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP()`))
The migration handler obviously doesn’t like the kysely import (using require
since it’s in JavaScript) giving me the error MODULE_NOT_FOUND
. Read around the docs and can’t see anything specific about migration dependencies or packaging options.
Any thoughts?Dani Akash
03/14/2022, 12:01 PMINFO: Checking for changes in the images service using lerna...
1.32 s
$ lerna ls --since 5841c598eef416cd0757681e6fa1f70f6b890136 --json -all
lerna notice cli v3.22.1
lerna info versioning independent
lerna info ci enabled
lerna notice filter changed since "5841c598eef416cd0757681e6fa1f70f6b890136"
lerna info Looking for changed packages since 5841c598eef416cd0757681e6fa1f70f6b890136
[]
lerna success found 0 packages
Checking for file changes that don't belong to any packages...
Need to deploy since the following files have been updated:
README.md
Learn more about monorepo deployments - seed.run/docs/deploying-monorepo-apps
Austin
03/14/2022, 5:06 PMArtemiy Davydov
03/14/2022, 5:40 PMallowOrigins: ['*']
I got CORS error WildcardOriginNotAllowed
Tony J
03/14/2022, 6:04 PMTypeError: Cannot read property ‘Symbol(@aws-cdk/core.Stack.myStack)’ of undefined
at Function.of (/node_modules/aws-cdk-lib/core/lib/stack.ts:67:20)
at lambdaAuthorizerArn (/node_modules/@aws-cdk/aws-apigatewayv2-authorizers-alpha/lib/http/lambda.ts:96:23)
at HttpLambdaAuthorizer2.bind (/node_modules/@aws-cdk/aws-apigatewayv2-authorizers-alpha/lib/http/lambda.ts:70:24)
Ross Gerbasi
03/14/2022, 8:29 PMcommandHooks
(https://docs.serverless-stack.com/constructs/Function#commandhooks) supposed to be run? I have a simple api with a custom lambda like this
const api = new sst.Api(this, 'Api', {
routes: {
'GET /': new Function(this, 'MyFunc', {
handler: 'src/lambda.handler',
bundle: {
commandHooks: {
beforeInstall() {
console.log('before install')
return [' echo beforeInstall']
},
beforeBundling(_, outDir) {
console.log('before bundle', outDir)
return [' echo beforeBundle']
},
afterBundling() {
console.log('after bundle')
return ['echo afterBundle']
},
},
},
}),
},
})
but I am not seeing those logs or echo's. How do ya get these things to run? Maybe this only runs on deploy...Jan Plaček
03/14/2022, 9:20 PMAPI_URL: `${staticSite.url}/api`
Adam Fanello
03/14/2022, 11:49 PM(node:26760) [DEP0128] DeprecationWarning: Invalid 'main' field in '/Users/adamfanello/dev/onica/casa/node_modules/@serverless-stack/resources/dist/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
If this was fixed in later release... then I can paste up all the errors I get when progressing beyond this version. 😞Jackson Bowe
03/15/2022, 5:46 AMPS D:\Projects\Mafia\my-sst-app> npx sst start
Using stage: dev
Preparing your SST app
=======================
Deploying debug stack
=======================
Usage: cdk -a <cdk-app> COMMAND
Commands:
cdk.js list [STACKS..] Lists all stacks in the app [aliases: ls]
... more of the same
... more of the same
If your app has a single stack, there is no need to specify the stack name
If one of cdk.json or ~/.cdk.json exists, options specified there will be used
as defaults. Settings in cdk.json take precedence.
There was an error synthesizing your app.
PS D:\Projects\Mafia\my-sst-app>
Best guess is that npx sst start
isn't providing any commands when calling cdk
.
I'd appreciate any assistance with this because it's got me pretty confused 😄
CheersHans Song
03/15/2022, 9:30 AMv0.67.0
1. deploy the stack
2. connect to a deployed stack with console
3. navigate to the functions view in the console
encountered this error
Uncaught TypeError: Cannot read properties of undefined (reading 'data')
which seems to correlate to these lines (construct
is undefined?)Artemiy Davydov
03/15/2022, 1:49 PMimport * as sst from "@serverless-stack/resources";
import { TableFieldType } from "@serverless-stack/resources";
import path from "path";
import { CorsHttpMethod } from "@aws-cdk/aws-apigatewayv2-alpha";
export default class CoreStack extends sst.Stack {
constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
super(scope, id, props);
const usersTable = new sst.Table(this, "UsersTable", {
fields: {
email: TableFieldType.STRING,
},
primaryIndex: { partitionKey: "email" },
});
const linksTable = new sst.Table(this, "LinksTable", {
fields: {
id: TableFieldType.STRING,
},
primaryIndex: { partitionKey: "id" },
});
const webStatic = new sst.ReactStaticSite(this, "WebStatic", {
path: path.resolve(__dirname, "../../frontend"),
cfDistribution: {
comment: "Distribution for React website",
},
});
const api = new sst.Api(this, "Api", {
defaultAuthorizationType: sst.ApiAuthorizationType.AWS_IAM,
cors: {
allowHeaders: ["Authorization", "Content-Type"],
allowMethods: [CorsHttpMethod.ANY],
allowOrigins: ["<http://localhost:3000>", webStatic.url],
allowCredentials: true,
},
defaultFunctionProps: {
// See /esbuild.js. This is necessary to support decorators
bundle: {
esbuildConfig: {
plugins: "esbuild-decorators-plugin.js",
},
},
environment: {
GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID || "",
GOOGLE_CLIENT_SECRET: process.env.GOOGLE_CLIENT_SECRET || "",
USERS_TABLE_NAME: usersTable.tableName,
LINKS_TABLE_NAME: linksTable.tableName,
},
permissions: [usersTable, linksTable],
},
routes: {
"GET /{id}": "src/functions/_id/get/handler.main",
"DELETE /links/{id}": "src/functions/links/_id/delete/handler.main",
"GET /links/{id}": "src/functions/links/_id/get/handler.main",
"PUT /links/{id}": "src/functions/links/_id/put/handler.main",
"POST /links/create": "src/functions/links/create/handler.main",
"GET /links/list": "src/functions/links/list/handler.main",
"GET /users/authRedirect":
"src/functions/users/authRedirect/handler.main",
"GET /users/me": "src/functions/users/me/handler.main",
},
});
this.addDefaultFunctionEnv({
FRONTEND_URL: webStatic.url,
API_URL: api.url,
});
this.addOutputs({
ApiEndpoint: api.url,
WebEndpoint: webStatic.url,
});
}
}
But I still have this in response headers:
access-control-allow-origin: *
Tell me, please, how do you configure CORS?