Skip to content

Visualiser: bundle the in-tree service-client#687

Merged
AlexGodbehere merged 1 commit into
mainfrom
ag/visualiser-intree-lib
Jul 21, 2026
Merged

Visualiser: bundle the in-tree service-client#687
AlexGodbehere merged 1 commit into
mainfrom
ag/visualiser-intree-lib

Conversation

@AlexGodbehere

Copy link
Copy Markdown
Contributor

Summary

The v6.1.0-ago releases shipped a visualiser bundle built from the npm-published service-client 1.3.6: the visualiser was the only JS service still depending on the registry package instead of file:../lib/js-service-client, and its Dockerfile ignored the lib build context CI has been passing all along. Result at runtime: bearer_jwt was unknown to the bundled client, so after a successful Keycloak login the fetch layer fell into the GSS /token path and died with GSS.createClientContext is not a function.

  • package.jsonfile:../lib/js-service-client, lockfile regenerated (npm keeps the lock authoritative under --save=false, so the stale registry pin was load-bearing).
  • Dockerfile copies the lib build context and installs with --install-links, matching the other services.
  • webpack config updated for the newer client: strip the node: scheme, stub fs/path/stream/async_hooks and the GSS fork. All are behind guarded dynamic imports with browser fallbacks, so stubbing is safe.

Verified by building the image exactly as CI does (docker build --build-context lib=./lib) and checking the produced bundle contains the bearer_jwt/jwt_mqtt code and service-client 1.6.0.

How to test

  1. Deploy, hard-refresh the visualiser, log in via Keycloak.
  2. The Directory lookup should now send Authorization: Bearer <JWT> (no /token request in the network tab) and the MQTT websocket should connect.

🤖 Generated with Claude Code

The visualiser was the only JS service still consuming
@amrc-factoryplus/service-client from the npm registry (^1.3.6), so
the v6.1.0 images shipped a bundle without bearer_jwt support and
JWT-authenticated sessions fell into the GSS /token path at runtime.
CI has passed the lib build context all along; only this Dockerfile
ignored it.

Switch to file:../lib/js-service-client like every other service,
copy the lib context in the Docker build with --install-links, and
regenerate the lockfile (npm treats the lock as authoritative under
--save=false, so the stale registry pin also had to go). The newer
client needs webpack taught about node:-scheme imports and the GSS
fork; all such modules are behind guarded dynamic imports so they
stub to empty in the browser.
@AlexGodbehere
AlexGodbehere merged commit 5bc1e52 into main Jul 21, 2026
1 check passed
@AlexGodbehere
AlexGodbehere deleted the ag/visualiser-intree-lib branch July 21, 2026 12:54
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.

1 participant