Sam Hulick
12/15/2021, 5:41 PMFazi
12/15/2021, 6:55 PM/**
* Lambda function layers
*/
const layer: any = new lambda.LayerVersion(this, 'integration-lambda-layers-forecast-layer', {
code: lambda.Code.fromAsset(path.join(__dirname, '..', '..', 'lambda_layers')),
compatibleRuntimes: [lambda.Runtime.PYTHON_3_8]
});
/**
* Lambda Functions
*/
const createDBTables = new Function(this, 'CreateDBTables', {
runtime: "python3.8",
srcPath: "src",
handler: 'create_db_tables.handler',
timeout: 300,
environment: env,
permissions: ['ssm', 'rds'],
description: "do something with rds.",
vpc: existingVpc,
securityGroups: [
functionSecurityGroup
],
logRetention: logs.RetentionDays.ONE_DAY,
layers: [layer], // This line is what seems to be causing the issue
});
However, I get the following error message:
Error: This lambda function uses a runtime that is incompatible with this layer (nodejs12.x is not in [python3.8])
In my index.ts file I have:
import * as cdk from "@aws-cdk/core";
import MyStack from "./MyStack";
import * as sst from "@serverless-stack/resources";
export default function main(app: <http://sst.App|sst.App>): void {
// Set default runtime for all functions
app.setDefaultFunctionProps({
runtime: "python3.8",
});
const stack = new MyStack(app, "stack");
cdk.Tags.of(stack).add("CfStackName", app.name);
cdk.Tags.of(stack).add("Organisation", 'asas');
cdk.Tags.of(stack).add("Department", 'asas');
cdk.Tags.of(stack).add("Environment", app.stage);
}
Can someone please explain why it throws that error - is there some sort of configuration missing? Given I am running a python lambda function, and the lambda layer is also in python, why does it need a nodejs runtime too?Dennis Dang
12/15/2021, 10:21 PMFailed to fetch resources. TypeError: pattern.source[0].startsWith is not a function
at /Users/dennisdang/Desktop/canopy/api/node_modules/@serverless-stack/cli/scripts/util/ConstructsState.js:326:30
at Array.filter (<anonymous>)
at ConstructsState.buildEventBusData (/Users/dennisdang/Desktop/canopy/api/node_modules/@serverless-stack/cli/scripts/util/ConstructsState.js:322:8)
at runMicrotasks (<anonymous>)
Example rule construct that I logged. The source is nested inside event pattern json.
{
Name: 'xxxx',
Arn: 'xxxx',
EventPattern: '{"detail-type":["Failed New Payment Request"],"source":["canopyapi.payment_request"]}',
State: 'ENABLED',
EventBusName: 'xxxx'
},
João Pedro
12/15/2021, 10:52 PMbuild
command and then, only with the .build
folder results execute the deployment (without the originating project)?Krizza
12/16/2021, 7:34 AMJack G
12/16/2021, 10:42 AMPaul
12/16/2021, 12:17 PMsst deploy
fails with the following error: Error: There was a problem transpiling the Lambda handler.
sst start
is working normally and all lambdas are compiling and running. Deploy also works when I remove my esbuildConfig
. It looks like this: esbuildConfig: { plugins: "config/esbuild.js" }
and contents of esbuild.js:
const { esbuildDecorators } = require("@anatine/esbuild-decorators");
module.exports = [esbuildDecorators()];
Any ideas? I know it would be helpful to get more detailed log output, but the --verbose
flag does not provide more info on the error.Joshua Sparks
12/16/2021, 5:27 PMsst build
but just fail and not finish the build if there are errors. Is this possible?Surf Turf
12/16/2021, 5:57 PM1. npx create-serverless-stack@latest sst-examples --language typescript
2. cd sst-examples
3. npm run start
Got following error:
/MASKED_PATH/node_modules/@serverless-stack/cli/scripts/start.js:322
result.error.stackTrace?.join("\n")
^
SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:1072:16)
at Module._compile (internal/modules/cjs/loader.js:1122:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (/MASKED_PATH/sst-examples/node_modules/@serverless-stack/cli/bin/scripts.js:59:16)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
Any idea about the problem?
Version 0.53.x works just fineSurf Turf
12/16/2021, 6:10 PMHaider Abbas
12/16/2021, 6:36 PMWe detected AWS AppSync APIs in your account leveraging GraphQL real-time subscriptions sending traffic based on our v1 protocol (MQTT over WebSockets) in the past 12 months. This is our final reminder on December 30, 2021, MQTT over WebSockets will be disabled for all AppSync APIs in all regions in favor of pure WebSockets.
Our recommended best practice is to have your APIs taking advantage of the v2 protocol (pure WebSockets) released in November 2019. We ask that you to update to pure WebSockets by December 30, 2021 to avoid any impact to existing applications. The update is easy and should only take minutes. Simply upgrade your clients to the latest AppSync SDK or Amplify clients for JavaScript/iOS/Android. The pure WebSockets v2 engine is used by default with the latest versions. The Amplify DataStore, which is a multi-platform (iOS/Android/React Native/Web) on-device persistent storage engine that automatically synchronizes data between mobile/web apps and the cloud, also uses our pure WebSockets protocol by default.
Please suggest me from where i start. I found the code snippet of above services in our code (web, mobile and api’s)
Great Thanks! for your precious timeSlackbot
12/16/2021, 8:46 PMTony J
12/17/2021, 12:56 AMIlia Reingold
12/17/2021, 2:18 AMauth.cognitoUserPool
to get the cdk methods :Dipsherman
12/17/2021, 5:08 PMnpx sst start
command, I get the following error/stack trace (replacing stuff specific to my operating system with os-stuff
):
/os-stuff/notes/node_modules/@serverless-stack/cli/scripts/start.js:308
result.error.stackTrace?.join("\n")
^
SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:1047:16)
at Module._compile (internal/modules/cjs/loader.js:1097:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (/os-stuff/notes/node_modules/@serverless-stack/cli/bin/scripts.js:59:16)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
I've done very little so far, just ran the npx create-serverless-stack@latest notes
command, `cd`'d into the directory, and changed the region to us-west-2
. I did just update npm in case that affects anything. Any assistance would be greatly appreciated! Thanks!Tonny (sstNerd)
12/17/2021, 7:01 PMthis.table_{something} = new Table(
for each table in dynamodb? Is that how it should work or would you do everything in one table? (if so, then how?)
Note: I’m aware I can “nest” data for example: car.invoices = []
and have the invoices there, but for the companies (makers), if I want to pull them dynamically from a table then it makes me some noiseAbdul Taleb
12/17/2021, 7:44 PMSam Hulick
12/17/2021, 9:39 PM.sst/artifacts/<hash>
folder? so for example.. I have a single Lambda handler right now, and that shows up in that folder as src/lambda.js
. I’ve run a separate build process before running yarn start
, and I want to have those resulting files copied into the same folder as the lambda.js
file. is that doable?Gabriel Araújo
12/17/2021, 11:06 PMApiEndpoint: <https://5hnofpe0i5.execute-api.us-east-1.amazonaws.com>
Stack gabiras-coffee-menu-websocket
Status: failed
Error: CloudWatch Logs role ARN must be set in account settings to enable logging (Service: AmazonApiGatewayV2; Status Code: 400; Error Code: BadRequestException; Request ID: cacfd1a9-235b-41e8-a17c-3dc8eeaf7845; Proxy: null)
Helper: This is a common error when configuring Access Log for WebSocket APIs. The AWS API Gateway service in your AWS account does not have permissions to the CloudWatch logs service. Follow this article to create an IAM role for logging to CloudWatch - <https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-cloudwatch-logs/>
Adrian Schweizer
12/19/2021, 6:29 PMDevin
12/19/2021, 7:42 PM// Create a HTTP API
this.api = new sst.Api(this, "Api", {
defaultAuthorizationType: "AWS_IAM",
defaultFunctionProps: {
environment: {
TABLE_NAME: customersTable.tableName,
},
},
// prettier-ignore
routes: {
"POST /profile": "src/profile/createProfile.main", // this isn't really doing anything but I thought maybe it would help
}
})
this.api.attachPermissions([customersTable]);
const auth = new sst.Auth(this, "Auth", {
cognito: {
userPool: {
signInAliases: { email: true },
},
defaultFunctionProps: {
timeout: 20,
environment: { TABLE_NAME: customersTable.tableName },
permissions: [customersTable],
},
lambdaTriggers: {
postAuthentication: "src/profile/createProfile.main",
},
},
});
Really all that happens in createProfile.main
right now is a console log.
import handler from “../utils/handler”;
import dynamoDb from “../utils/dynamodb”;
export const main = handler(async (event) => {
console.log("[44m%s[0m", `--(event--${JSON.stringify(event)}-----`);
But I can’t see that on signUp. Which i guess sorta makes sense because that’s a service that’s outside of Live Lambda development maybe?
How can I log out the event so I can figure out what I want in my table?mkarsene
12/20/2021, 7:55 AMErik Robertson
12/20/2021, 9:04 AMSam Hulick
12/20/2021, 5:55 PMcurrentVersionOptions: {
provisionedConcurrentExecutions: 1,
},
I made that change to the sst.Function
, and it results in no changes to the stack 🤔vinash
12/20/2021, 7:49 PMTypeError: Cannot read properties of undefined (reading 'send')
at Object.send (/Users/********/Applications/notes/node_modules/@serverless-stack/core/dist/cli/FunctionBuilder.js:57:21)
at WS.handleRequest (/Users/********/Applications/notes/node_modules/@serverless-stack/cli/scripts/start.js:253:21)
at WS.<anonymous> (/Users/********/Applications/notes/node_modules/@serverless-stack/core/dist/runtime/ws.js:100:41)
at Generator.next (<anonymous>)
at /Users/********/Applications/notes/node_modules/@serverless-stack/core/dist/runtime/ws.js:8:71
at new Promise (<anonymous>)
at __awaiter (/Users/********/Applications/notes/node_modules/@serverless-stack/core/dist/runtime/ws.js:4:12)
at WS.handleMessage (/Users/********/Applications/notes/node_modules/@serverless-stack/core/dist/runtime/ws.js:62:16)
at WebSocket.<anonymous> (/Users/********/Applications/notes/node_modules/@serverless-stack/core/dist/runtime/ws.js:59:49)
at WebSocket.emit (node:events:390:28)
Then when I run "sst start" again everything works just fine. And that sst start from the commandline states that no changes were deployed.
If I add another api when sst start is not running and then do sst start which triggers the deployment everything works fine as well.
So it seems like there is some state in memory in the local development server that doesn't work well when adding new API's.
Any ideas what's causing this?Tonny (sstNerd)
12/20/2021, 8:57 PMDavid Garcia
12/20/2021, 9:05 PMError: There was a problem transpiling the lambda handler
and then further down
There was an error synthesizing your app
I would love to provide more info on this but the stack trace isn't indicating where the error is coming from in my code. I am trying to integrate gremlin-js library within a lambda function, whenever I remove the code to query my gremlin server, it seems to deploy just fine. Outside of that, I don't know the exact reason for why this could be occurring. If I could get some more clarity on the above 2 errors, I might be able to narrow down the issue further on my end.Sam Hulick
12/20/2021, 9:10 PM❌ dev-microservices-api-base failed: Export dev-microservices-api-base:ExportsOutputFnGetAttGetPresentationReelFuncE29CE098ArnD35372FB cannot be deleted as it is in use by dev-microservices-api-public and dev-microservices-api-reels
I removed all references to this function! I even removed the function itselfSam Hulick
12/20/2021, 9:29 PMSam Hulick
12/20/2021, 10:55 PM$LATEST
version of the function. how do I make it point to the specific version? and more importantly, how do I ensure that when I update the code and the Lambda version gets bumped, that anything else that depends on that Lambda func updates its reference? I would think if I create an SST function using provisioned concurrency and i pass that function as an API route, it the API Gateway integration would point to the version, but it doesn’t