Repository navigation
Remove the esm loader and install yarn in the Docker build - #74
Conversation
The esm package crashes on Node 24 with "TypeError: Function.prototype.apply was called on undefined" while loading module-alias/register, so every representer run exits with status 1. The TypeScript build outputs CommonJS, so esm has nothing to do and can go. The node:lts-alpine tag now points to Node 26, which ships without yarn, so the image no longer builds. Pin the base image to the same Node 24 digest used by the analyzers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This should not pin version 24 and instead fix the build by downloading yarn or something like that. |
The Node 26 image has no yarn and no corepack, so install yarn with npm in the builder stage and keep the base image on node:lts-alpine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This reply is from Claude, an AI assistant working on iHiD's behalf. Node is no longer pinned. The Dockerfile uses |
| @@ -1,9 +1,11 @@ | |||
| # sha256:a0b9bf06e4e6193cf7a0f58816cc935ff8c2a908f81e6f1a95432d679c54fbfd => node:24.18.0-alpine3.24 | |||
| FROM node:lts-alpine@sha256:a0b9bf06e4e6193cf7a0f58816cc935ff8c2a908f81e6f1a95432d679c54fbfd as builder | |||
| FROM node:lts-alpine as builder | |||
There was a problem hiding this comment.
We do want pinned hashes in general so different runners can share a common base.
node:lts-alpine@sha256:a0b9bf06e4e6193cf7a0f58816cc935ff8c2a908f81e6f1a95432d679c54fbfd looks to be the most commonly used hash across runners at the moment. With !75 dependabot will open version bumps as needed.
|
This comment is from Claude, an AI assistant working on iHiD's behalf. @SleeplessByte, would you rather these representers run on Node 24 or Node 26? We'd like every tool to share the same pinned Node base image, because a shared base makes the tooling machines boot much faster. The digest that @IsaacG suggested ( Both work with this PR's fix. Once you choose, I'll update this PR and exercism/typescript-representer#31 to match. |
|
The latest hash of We can use that across |
|
Yes. Use the latest hash Isaac suggested. That's what I've also always done. In this repo we use lts, whatever is latest. |
Both stages now use node:26-alpine3.24 by digest, the current node:lts-alpine image. That image has no yarn, so the builder stage still installs it with npm. Co-authored-by: iHiD <286476+iHiD@users.noreply.github.com>
|
This comment is from Claude, an AI assistant working on iHiD's behalf. Thanks, @SleeplessByte and @IsaacG. Both this PR and exercism/typescript-representer#31 are now pinned to that digest, and the smoke tests pass on both. |
This PR was opened by Claude, an AI assistant working on iHiD's behalf.
What was broken
Every representer job in production fails. The tooling invoker logs each one as status 513, so no representations are made. The invoker's logs go back 3.5 days, and every job in that period failed.
There are two separate problems:
bin/run.shrunsnode -r esm -r module-alias/register ./dist/represent.js. Theesmpackage (unmaintained since 2019) crashes on current Node versions, so the representer exits with status 1 before it does any work.node:lts-alpinebase tag now points to Node 26, which ships withoutyarn, soyarn installfails and the image can't be built. The Deploy run for Update pr.ci.js.yml #72 on 13 November failed at this step.Evidence
The production image (
exercism/javascript-representer:latest, built on 22 September, Node v24.21.0) fails when run on thetwo-ferfixture. It writes 65 KB of minifiedesm.jssource to stderr and exits with 1. With anuncaughtExceptionhandler loaded first, the error is:I ran the same
distfolder with-r esmon Node 22.22.0, 24.0.0, 24.10.0, 24.18.0 and 24.21.0, and it failed on all of them. Without-r esm, the same production image on Node 24.21.0 producesrepresentation.txtandmapping.jsonthat match the fixture's expected files.The TypeScript build already outputs CommonJS (
"module": "CommonJs"intsconfig.json), soesmhas nothing to do.Fix
-r esmfrom every script inbin/and fromsrc/remote-represent.ts, and removesesmfrompackage.jsonandyarn.lock.FROMlines tonode:26-alpine3.24@sha256:6bd9ab43c0ec0190ca7b2d193906cb8b7edf6e7f4afa43ddeccd6452710bffb5, the currentnode:lts-alpinedigest.npm install -g yarnin the builder stage, because that image has noyarnand nocorepack, andpackage.jsonhas nopackageManagerfield.Verification
bin/run-tests-in-docker.shbuilds the image and passes./mnt/exercism-iteration, the argumentstwo-fer /mnt/exercism-iteration/ /mnt/exercism-iteration/, with--network none --read-only. The container exited with 0, andrepresentation.txtandmapping.jsonmatch the expected files.yarn install --frozen-lockfilesucceeds with yarn 1.22.22 on Node 26.13.1, and Prettier 2.7.1 passes on the changed files.After merging
The Deploy workflow will build the image and push it to ECR with the
productiontag, which the tooling invoker runs. Representer jobs should then succeed.🤖 Generated with Claude Code