By using AWS re:Post, you agree to the Terms of Use

Questions tagged with AWS Lambda

Sort by most recent
  • 1
  • 12 / page

Browse through the questions and answers listed below or filter and sort to narrow down your results.

Amplify auto-generated lambda functions using Node 12

I created an Amplify app with back-end a couple of weeks ago. This caused a few Lambda functions to be generated, such as "amplify-login-verify-auth-challenge-SHORTCODE" as described [here](https://docs.amplify.aws/console/adminui/access-management/). The functions use Node 12 as the runtime environment. Yesterday I received an email from AWS saying Node 12 will no longer be supported by AWS. Will Amplify be updated - or is there something I can do to make sure the Amplify-generated functions use a newer version of Node going forward? For reference, here is the content of the email: ``` Amazon Web Services, Inc. <no-reply-aws@amazon.com> Sun, Aug 14, 9:55 AM (1 day ago) to XXX Hello, We are contacting you as we have identified that your AWS Account currently has one or more Lambda functions using Node.js 12 runtime. We are ending support for Node.js 12 in AWS Lambda. This follows Node.js 12 End-Of-Life (EOL) reached on April 30, 2022 [1]. As described in the Lambda runtime support policy [2], end of support for language runtimes in Lambda happens in two stages. Starting November 14, 2022, Lambda will no longer apply security patches and other updates to the Node.js 12 runtime used by Lambda functions, and functions using Node.js 12 will no longer be eligible for technical support. In addition, you will no longer be able to create new Lambda functions using the Node.js 12 runtime. Starting December 14, 2022, you will no longer be able to update existing functions using the Node.js 12 runtime. We recommend that you upgrade your existing Node.js 12 functions to Node.js 16 before November 14, 2022. End of support does not impact function execution. Your functions will continue to run. However, they will be running on an unsupported runtime which is no longer maintained or patched by the AWS Lambda team. The following command shows how to use the AWS CLI [3] to list all functions in a specific region using Node.js 12. To find all such functions in your account, repeat this command for each region: aws lambda list-functions --function-version ALL --region us-east-1 --output text --query "Functions[?Runtime=='nodejs12.x'].FunctionArn" If you have any concerns or require further assistance, please contact AWS Support [4]. [1] https://nodejs.org/en/blog/release/v12.22.12/ [2] https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html [3] https://aws.amazon.com/cli/ [4] https://aws.amazon.com/support Sincerely, Amazon Web Services Amazon Web Services, Inc. is a subsidiary of Amazon.com, Inc. Amazon.com is a registered trademark of Amazon.com, Inc. This message was produced and distributed by Amazon Web Services Inc., 410 Terry Ave. North, Seattle, WA 98109-5210 ```
1
answers
0
votes
7
views
asked 12 hours ago
0
answers
0
votes
18
views
asked 4 days ago

Error when using converted CJS > ESM npm library

I am trying out using ESM for some Lambda NodeJS functions. I have a compiled js file (from typescript, using esnext), a symlink to the node_modules folder (see https://github.com/vibe/aws-esm-modules-layer-support) and a basic package.json file that has a name, and `"type": "module"` set. Some functions work fine, but a few that use a shared package are not loading. The package is this one, https://github.com/capaj/object-resolve-path, but I have forked it to my own private repo, and converted it to ESM. I don't get any TS compilation errors, but when I try to invoke the function, it is failing with the following error: > 2022-08-12T12:58:58.467Z undefined ERROR Uncaught Exception {"errorType":"Runtime.UserCodeSyntaxError","errorMessage":"SyntaxError: Unexpected token '{'","stack":["Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token '{'"," at _loadUserApp (file:///var/runtime/index.mjs:724:17)"," at async Object.module.exports.load (file:///var/runtime/index.mjs:741:21)"," at async file:///var/runtime/index.mjs:781:15"," at async file:///var/runtime/index.mjs:4:1"]} I'm not getting any syntax errors show when editing the module code in VSCode. So I must have converted the module wrong? But I can't see what is wrong. I added an index.d.ts file with: ``` declare module 'object-resolve-path' { export default function resolvePath(obj: any, path: string): any; } ``` And changed `module.exports` to `export const ...` eg Before ``` var Path = require('./path') module.exports = function (o, path) { if (typeof path !== 'string') { throw new TypeError('path must be a string') } if (typeof o !== 'object') { throw new TypeError('object must be passed') } var pathObj = Path.get(path) if (!pathObj.valid) { throw new Error('path is not a valid object path') } return pathObj.getValueFrom(o) } ``` Now ``` import Path from './path.js'; export default resolvePath(o, path) { if (typeof path !== 'string') { throw new TypeError('path must be a string') } if (typeof o !== 'object') { throw new TypeError('object must be passed') } var pathObj = Path.get(path) if (!pathObj.valid) { throw new Error('path is not a valid object path') } return pathObj.getValueFrom(o) } ``` I can't figure out anyway to debug this locally, as the lambda functions are part of a mono-repo setup, and they deploy via cloudformation as various stacks.
0
answers
0
votes
4
views
asked 4 days ago

Sagemaker Data Capture does not write files

I want to enable data capture for a specific endpoint (so far, only via the console). The endpoint works fine and also logs & returns the desired results. However, no files are written to the specified S3 location. ### Endpoint Configuration ### The endpoint is based on a training job with a scikit learn classifier. It has only one variant which is a `ml.m4.xlarge` instance type. Data Capture is enabled with a sampling percentage of 100%. As data capture storage locations I tried `s3://<bucket-name>` as well as `s3://<bucket-name>/<some-other-path>`. With the "Capture content type" I tried leaving everything blank, setting `text/csv` in "CSV/Text" and `application/json` in "JSON". ### Endpoint Invokation ### The endpoint is invoked in a Lambda function with a client. Here's the call: ``` sagemaker_body_source = { "segments": segments, "language": language } payload = json.dumps(sagemaker_body_source).encode() response = self.client.invoke_endpoint(EndpointName=endpoint_name, Body=payload, ContentType='application/json', Accept='application/json') result = json.loads(response['Body'].read().decode()) return result["predictions"] ``` Internally, the endpoint uses a Flask API with an `/invocation` path that returns the result. ### Logs ### The endpoint itself works fine and the Flask API is logging input and output: ``` INFO:api:body: {'segments': [<strings...>], 'language': 'de'} ``` ``` INFO:api:output: {'predictions': [{'text': 'some text', 'label': 'some_label'}, ....]} ```
0
answers
0
votes
35
views
asked 6 days ago
  • 1
  • 12 / page