Skip to content

Conversation

kakakakakku
Copy link
Contributor

Issue #, if available:
N/A

Description of changes:
Hi😀 Thanks for the useful patterns!

To prevent future deployment issues, I updated the deprecated Lambda Node.js runtime nodejs16.x to nodejs22.x.
See https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html

Check

$ wscat -c "wss://tps57mtdk0.execute-api.ap-northeast-1.amazonaws.com/dev?proto=https"
Connected (press CTRL+C to quit)
> { "bucketName": "apigw-lambda-sfn-transcribe-translatorbucket-fyc2ikzohkyu", "objectKey": "audio.ogg", "inputLanguageCode": "en-IN", "outputLanguageCode" : "ja-JP" }
< {"url":"https://apigw-lambda-sfn-transcribe-translatorbucket-fyc2ikzohkyu.s3.ap-northeast-1.amazonaws.com/c0d4104e-3e08-4b7c-aa52-327f423045df.mp3?xxx"}
image

Thank you😀


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

await apig
.postToConnection({
let response = await stepfunctions.send(new StartSyncExecutionCommand(params));
await apig.send(new PostToConnectionCommand({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Some error occurs. Because in Node.js 18 and later runtimes, AWS SDK v3 is bundled, so I rewrote it to v3. See articles below.

const { ApiGatewayManagementApiClient, PostToConnectionCommand } = require('@aws-sdk/client-apigatewaymanagementapi');
const stepfunctions = new SFNClient({});
const apig = new ApiGatewayManagementApiClient({
endpoint: `https://${process.env.APIG_ENDPOINT}`,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Some error occurs. Because we need use connections url with https.

< {"message": "Internal server error", "connectionId":"R-c1lc6StjMCFug=", "requestId":"R-d65GZntjMECaQ="}

const AWS = require('aws-sdk');
const s3 = new AWS.S3();
const polly = new AWS.Polly();
const uuidv1 = require('uuidv1');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Some error occurs.

{
  "errorType": "Runtime.ImportModuleError",
  "errorMessage": "Error: Cannot find module 'uuidv1'\nRequire stack:\n- /var/task/src/speech.js\n- /var/runtime/index.mjs",
  "trace": [
    "Runtime.ImportModuleError: Error: Cannot find module 'uuidv1'",
    "Require stack:",
    "- /var/task/src/speech.js",
    "- /var/runtime/index.mjs",
    "    at _loadUserApp (file:///var/runtime/index.mjs:1192:17)",
    "    at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1235:21)",
    "    at async start (file:///var/runtime/index.mjs:1454:23)",
    "    at async file:///var/runtime/index.mjs:1464:1"
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants