Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Working With Data
  2. Axonmundi
  3. Testing Dev Router

Test against the dev router

Call the dev Cosmo router with a real token, check subscriptions, and point a local responder at it

These steps call the dev Cosmo router with your own token. You need the Carbyne VPN (setup guide). All six steps have been verified end to end on the Carbyne VPN. Set the router URL once. It is the Cosmo router's dev URL from AxonMundi onboarding:
  1. Get a token from a local apps/auth on port 5200.
    • In apps/auth/.env, uncomment the KEYCLOAK_ISSUER, KEYCLOAK_CLIENT_ID and KEYCLOAK_SCOPE lines from .env.example. Without them the local sign-in offers only Okta, and the router accepts only Keycloak tokens.
    • Run apps/auth, open http://localhost:5200/login?client=axon-proto, and sign in with Keycloak.
    • Open http://localhost:5200/api/auth/session?client=axon-proto and export the accessToken:
    Check the token's claims:
    • iss is https://iam-service-dev-eu-west-1.carbyneapi-dev.com/auth/realms/carbyne.
    • azp is c-operator-client.
    • scope includes prepared-claims.
    • prepared_user_id is present.
    The token lasts about 4 hours. See Authentication for which tokens the router accepts.
  2. Check the router is up. The -4 flag is there because the VPN has no IPv6:
    Expect HTTP 200 with no token.
  3. Check auth is enforced. Make the same call with { currentUser { id } } and no token. Expect HTTP 401 with {"errors":[{"message":"unauthorized"}]}.
  4. Call with the token. Add -H "authorization: Bearer $TOKEN" to the currentUser call. Expect HTTP 200 with your user. If you get data: null with Failed to fetch from Subgraph 'prepared911', Rails refused the token.
  5. Smoke-test a subscription. From an AxonMundi checkout, run its scripts/smoke-subscription.mjs:
    Expect a userNotification event within a few seconds and exit code 0.
  6. Try it from the responder. Local only, commit nothing.
    • In apps/responder/public/config/appConfig.json, set:
      AUTH_HOST_URL is the local apps/auth host from step 1.
    • In apps/responder/src/config/mundi.ts, drop || auth.clientId !== AuthClientId.Responder.
    • Run apps/auth, then pnpm dev:responder, and sign in with Keycloak.
    • Also run pnpm --filter core dev (port 5109). The production core remote lags trunk, and the navbar crashes without the local one.
    The navbar bell queries currentUser and subscribes to userNotification. Expect:
    • the bell shows the unread count;
    • the WebSocket (graphql-transport-ws) goes connection_init, connection_ack, then subscribe for OnUserNotification;
    • a live event arrives;
    • no CORS errors on router calls.
    CORS errors on mf-manifest.json are expected for remotes you do not serve locally: the responder falls back to the production remotes. If a screen fails, serve that remote with pnpm --filter <remote> dev.
Known issues
  • The first subscription frame errors with Cannot return null for non-nullable field 'Subscription.userNotification'. It likely comes from the Rails side. Real events still arrive after it.
  • AnyCable subscriptions through the router have problems. They are being investigated.
Do not paste the token into tickets, PRs, or Studio Playground sessions.
Previous
AxonMundi / Real-time data and WebSockets
Next
Testing strategy / Testing Principles
On this page
Known issues