Sam Hulick
08/17/2021, 3:03 AMBen McGraw
08/17/2021, 3:16 AMBen McGraw
08/17/2021, 3:18 AMSam Frampton
08/17/2021, 10:27 AMs3*
and added the arn and bucket name to environment and resource from my sst created bucket. I'm still getting permission denied 403, can someone explain why this is case?Aram
08/17/2021, 11:59 AMERROR Error [TypeError]: (intermediate value)(intermediate value)(intermediate value).toLowerCase is not a function
at TraceListener.onWrap (/code/messaging/node_modules/datadog-lambda-js/src/trace/listener.ts:117:67)
datadog-lambda-js
needs a wrapper around the function's handler and it seems like it's failing because sst is re-wrapping the handler.
Is that assumption correct? If so, is there a way to have dd wrapper around sst wrapper?
Thanks!Guy Shechter
08/17/2021, 1:03 PMSam Hulick
08/18/2021, 2:59 AMyarn start
is agonizingly slow. I’ve been sitting here for almost 10 minutes. I just changed a few Lambdas tied to HTTP API. is there anything I can do to speed this up?Vishal Vijay
08/18/2021, 7:35 AMSam Hulick
08/18/2021, 8:46 PMSam Hulick
08/18/2021, 9:09 PM"Runtime.ImportModuleError: Error: Cannot find module './dialects/postgres/index.js'"
Sam Hulick
08/18/2021, 10:23 PMserverless-webpack
..then I switched to serverless-esbuild
and it would rip through 70+ functions in less than 15-20 secondsSam Hulick
08/18/2021, 10:31 PMmiddy
for API request validation? for some reason, invalid API calls (missing required params) are being passed to the underlying Lambda codeSam Hulick
08/18/2021, 11:41 PMaws lambda add-layer-version-permission --layer-name <xyz>
every time I update a layer? (I’m maintaining these in the primary AWS account, as devs shouldn’t have to bother with these. this seems like an easy thing to forget to doSam Hulick
08/19/2021, 12:04 AMrelease: process.env.SENTRY_RELEASE
, and each time I deploy, SENTRY_RELEASE
is the git hash of the current commit. this works fine with associating each function w/ the proper release in Sentry, but the downside is that every time I deploy, EVERY function gets an update. I wonder if there’s a better way to do thisSam Hulick
08/19/2021, 5:46 AMimport { defaultProvider } from '@aws-sdk/credential-provider-node';
import AWSAppSyncClient, { AUTH_TYPE } from 'aws-appsync';
import 'isomorphic-fetch';
const appSyncClient = new AWSAppSyncClient({
url: process.env.GRAPHQL_ENDPOINT_URL,
region: 'us-east-1',
auth: {
type: AUTH_TYPE.AWS_IAM,
credentials: defaultProvider(),
},
disableOffline: true,
});
let client: AWSAppSyncClient<any>;
export default async function getGraphqlClient() {
if (client) return client;
client = await appSyncClient.hydrated();
return client;
}
the credentials are no good for some reason, I’m getting a 401 when my API tries to make a GraphQL call 🤔Sam Hulick
08/19/2021, 3:53 PMapp.setDefaultFunctionProps()
?
layers: [
lambda.LayerVersion.fromLayerVersionArn(
app,
'KnexLayer',
process.env.KNEX_LAYER_ARN
),
],
I’m getting: `Error: Import at 'KnexLayer' should be created in the scope of a Stack, but no Stack found`why have a layers
array on that method then?Sam Hulick
08/19/2021, 4:57 PMSomething went wrong installing the "sharp" module
Cannot find module '../build/Release/sharp-darwin-x64.node'
Require stack:
- /Volumes/SuperData/Sites/reelcrafter/v2-microservices/.build/src/services/media-processor/functions/get-metadata.js
- /Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/cli/scripts/util/bootstrap.js
my theory is that the Lambda code is running locally on the Darwin architecture, but it’s using the Lambda layer which is Amazon Linux arch. how can I solve this?Sam Hulick
08/19/2021, 8:25 PMstack.stackName
does)Kujtim Hoxha
08/19/2021, 8:27 PM<http://media.mysite.com/|media.mysite.com/>...
, I was trying to use the StaticSite
as an example but for some reason the DnsValidatedCertificate
is giving me an error, it is trying to find a lambda function in lambda.Code.fromAsset(path.resolve(__dirname, '..', 'lambda-packages', 'dns_validated_certificate_handler', 'lib')),
looking at the source code and because of that sst start
is giving me an error
Error: Cannot find asset at /Users/path/to/my/app/.build/lambda-packages/dns_validated_certificate_handler/lib
Sam Hulick
08/19/2021, 9:43 PMsrc/lambda
folder (which is a workspace/subpackage), I have this tsconfig:
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"$core/*": ["../core/*"],
"$libs/*": ["./libs/*"],
"$types/*": ["./types/*"]
},
}
}
this works perfectly fine, so anywhere in lambda/* I can do import { blah } from '$libs/whatever'
. at least, VS Code says it’s fine and it resolves.. but when I do `yarn build`:
src/lambda/graphql/mutations/update-transcoding-status.ts:2:31 - error TS2307: Cannot find module '$libs/db' or its corresponding type declarations.
2 import { dataApi, knex } from '$libs/db';
how do I resolve this?Sam Hulick
08/19/2021, 10:35 PMimport
statements (bad paths) and SST let me run yarn start
and got all the way through type-checking, building, and was about to start a debug process and then it bombed. I ran yarn test
after just to see, and it reports no issues.Anupam Dixit
08/20/2021, 7:18 AMStagingBucket cdk-hnb659fds-assets-741386957827-ap-south-1 already exists
. How to get around with this ? (or why this might be happening?)
2. SST is also creating resources prefixed with cdk-*
for iam roles and bucket names (in addition to the resources prefixed with stage name). Can I rename them somehow in my code ? So I can use prefixes like dev-*
for these resources based on the stage name ?
3. What is the role of aws ssm in serverless stack deployment ? -> I was not giving ssm permissions earlier, as I did not think it is necessary, but getting this error user is not authorized to perform: ssm:PutParameter on resource: arn:aws:ssm:ap-south-1:741386957827:parameter/cdk-bootstrap/hnb659fds/version
. Do I have to give these permissions to the user too then ?
Please let me know if any more clarification is needed.Aram
08/20/2021, 8:41 AMSam Hulick
08/20/2021, 6:45 PMSam Hulick
08/20/2021, 8:55 PMArtem Pabacham
08/21/2021, 10:05 AMconst uploadFilesConfig = s3.Bucket.fromBucketName(
stack,
"UploadFilesBucketDev",
process.env.AWS_S3_UPLOAD_FILES_BUCKET_NAME,
);
this.uploadFilesBucket = new sst.Bucket(stack, "UploadFilesBucket", {
s3Bucket: uploadFilesConfig,
});
Slawomir Stec
08/21/2021, 3:20 PMimport {APIGatewayProxyEventV2, APIGatewayProxyHandlerV2} from "aws-lambda";
import * as fs from 'fs'
export const handler: APIGatewayProxyHandlerV2 = async (event: APIGatewayProxyEventV2) => {
fs.readdirSync("/").forEach(file => {
console.log(file);
});
return {
statusCode: 200,
headers: {"Content-Type": "text/plain"},
body: `Response: ${JSON.stringify({})}`,
};
};
I come across this when trying to use EFS in the lambda code. Attached code list my OS folder structure. Any hints?Artem Pabacham
08/22/2021, 3:38 PMSam Hulick
08/22/2021, 7:30 PMGET /things/{id}
to GET /things/{thingId}
. you’ll get an error saying the route already exists.. so it seems you have to fully remove that route, deploy, add it back in, and deploy againAndrew Myers
08/23/2021, 6:45 AMModuleNotFoundError: No module named 'boto3'
when I call the endpoint provided by npx sst start