Skip to content

Chi 3816 fix e2e broadcast message#4192

Open
stephenhand wants to merge 5 commits intomasterfrom
CHI-3816-fix_e2e_broadcast_message
Open

Chi 3816 fix e2e broadcast message#4192
stephenhand wants to merge 5 commits intomasterfrom
CHI-3816-fix_e2e_broadcast_message

Conversation

@stephenhand
Copy link
Copy Markdown
Collaborator

Description

Checklist

  • Corresponding issue has been opened
  • New tests added
  • Feature flags added
  • Strings are localized
  • Tested for chat contacts
  • Tested for call contacts

Other Related Issues

None

Verification steps

AFTER YOU MERGE

  1. Cut a release tag using the Github workflow. Wait for it to complete and notify in the #aselo-deploys Slack channel.
  2. Comment on the ticket with the release tag version AND any additional instructions required to configure an environment to test the changes.
  3. Only then move the ticket into the QA column in JIRA

You are responsible for ensuring the above steps are completed. If you move a ticket into QA without advising what version to test, the QA team will assume the latest tag has the changes. If it does not, the following confusion is on you! :-P

@stephenhand
Copy link
Copy Markdown
Collaborator Author

@copilot

The production E2E tests deployed in the lambda are failing with the following error

2026-04-20T08:28:35.715Z	-	ERROR	Init Error 	{"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module 'handler'
Require stack:
- /usr/lib/node_modules/aws-lambda-ric/index.mjs","name":"Runtime.ImportModuleError","stack":["Runtime.ImportModuleError: Error: Cannot find module 'handler'","Require stack:","- /usr/lib/node_modules/aws-lambda-ric/index.mjs","    at loadModule (file:///usr/lib/node_modules/aws-lambda-ric/index.mjs:575:13)","    at async UserFunctionLoader.load (file:///usr/lib/node_modules/aws-lambda-ric/index.mjs:506:20)","    at async createRuntime (file:///usr/lib/node_modules/aws-lambda-ric/index.mjs:1219:52)","    at async ignition (file:///usr/lib/node_modules/aws-lambda-ric/index.mjs:1635:21)"]}

The Dockerfile was missing some dependencies which have been added, and these tests executed via the lambda deployed in this run executed correctly: https://github.com/techmatters/flex-plugins/actions/runs/17650330653

Identify the issue with the docker image / lambda configuration that could be causing this latest version to fail, and if possibly, write a fix

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

@copilot

The production E2E tests deployed in the lambda are failing with the following error
...

The issue is that aws-lambda-ric is installed without a pinned version (npm install aws-lambda-ric -g). The current latest is v4.0.2, which uses ESM (index.mjs). In this newer version, when LAMBDA_TASK_ROOT is not set, it no longer falls back to process.cwd() — it defaults to /var/task or attempts to resolve the bare module name 'handler' directly, neither of which finds handler.js at /app/e2e-tests/handler.js.

Fixed in commit 0e2501d by adding ENV LAMBDA_TASK_ROOT=/app/e2e-tests to the final stage of e2e-tests/Dockerfile, explicitly telling aws-lambda-ric where to find the handler module.

@stephenhand
Copy link
Copy Markdown
Collaborator Author

@copilot - adding the environment variable to the docker container did not fix the issue:

2026-04-20T10:36:37.105Z	-	ERROR	Init Error 	{"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module 'handler'
Require stack:
- /usr/lib/node_modules/aws-lambda-ric/index.mjs","name":"Runtime.ImportModuleError","stack":["Runtime.ImportModuleError: Error: Cannot find module 'handler'","Require stack:","- /usr/lib/node_modules/aws-lambda-ric/index.mjs","    at loadModule (file:///usr/lib/node_modules/aws-lambda-ric/index.mjs:575:13)","    at async UserFunctionLoader.load (file:///usr/lib/node_modules/aws-lambda-ric/index.mjs:506:20)","    at async createRuntime (file:///usr/lib/node_modules/aws-lambda-ric/index.mjs:1219:52)","    at async ignition (file:///usr/lib/node_modules/aws-lambda-ric/index.mjs:1635:21)"]}

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

@copilot - adding the environment variable to the docker container did not fix the issue:

2026-04-20T10:36:37.105Z	-	ERROR	Init Error 	{"errorType":"Runtime.ImportModuleError","errorMessage":"Er...

The previous fix was wrong. AWS Lambda always injects LAMBDA_TASK_ROOT=/var/task into the container environment at runtime, unconditionally overriding any ENV set in the Dockerfile — so that fix had no effect.

aws-lambda-ric v4.x reads process.env.LAMBDA_TASK_ROOT at runtime and resolves the handler as path.resolve(taskRoot, 'handler') = /var/task/handler. Since /var/task didn't exist in the ubuntu:jammy image, this failed.

Fixed in commit ba2183d: instead of trying to override Lambda's LAMBDA_TASK_ROOT, we now create a symlink ln -sf /app/e2e-tests /var/task in the Dockerfile. This makes /var/task/handler.js resolve via the symlink to /app/e2e-tests/handler.js, which is where the handler and its node_modules dependencies live.

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.

2 participants