NexusConfigError naming the option, the reason and the value
you passed - including the array index for a schedule entry. Nothing is coerced:
a coerced mistake resurfaces days later as unexplained load or a stalled stream,
with nothing pointing back at the cause.
Options
Changing the configuration
<NexusProvider> compares the configuration by value on every render, so an object literal written
inline does not create a new client. A new client is created - the old one closed, and
loadingFallback shown again until its first sync - when one of these changes: baseUrl, apiKey
(compared through a digest, never stored), ttlMs, requestTimeoutMs, streamConnectTimeoutMs,
streamIdleTimeoutMs or sseReconnectCooldown. logger and streamObserver are read when the
client is created; passing a different one later has no effect until one of the options above
changes.
Local development
Start the app withwestyx dev run and give the SDK neither baseUrl nor apiKey:
westyx dev run starts a local session broker for the lifetime of the dev server and passes its
address as WESTYX_DEV_BROKER. The dev server forwards /__westyx to it, and the SDK reads the
service endpoint and a Developer WIF session from /__westyx/session on the page’s own origin,
sends the session as Authorization: Bearer, and renews it before it expires - re-running
westyx dev setup while the app runs is picked up without a restart. The session acts as a public
key: configs and flags, never secrets.
Only the dev server forwards that path, so a production build never reaches a session; production
keeps baseUrl and apiKey. The developer session exists only in a browser: a keyless
configuration during server-side rendering is a NexusConfigError.
The dev server needs one proxy entry; westyx dev setup recognises the framework and prints the
lines, or writes them for Angular.
Vite:
NexusInitError carries a NexusDevSessionError that says
why - most often that the app was not started with westyx dev run or that the proxy entry is
missing. See Error handling.
Endpoint per environment in production
In production the endpoint and the key are passed in code. To vary them per build, use your build tool’s public variables, which are inlined at build time:- Vite: a
VITE_-prefixed variable in.env,.env.developmentor.env.production, read asimport.meta.env.VITE_NEXUS_BASE_URL. - Next.js: a
NEXT_PUBLIC_-prefixed variable, read asprocess.env.NEXT_PUBLIC_NEXUS_BASE_URLin client code.
wxp_ key are public by design, but keep secrets out of it.
What gets rejected
The deadlines, and why there are three
A request without a deadline is the failure that wedges a client: a connection a middlebox has stopped answering never settles, and the in-flight guard it holds is never released.requestTimeoutMs bounds that.
A live stream needs different treatment, because it is supposed to stay open
with nothing arriving. streamConnectTimeoutMs bounds only the connection
attempt. streamIdleTimeoutMs is the liveness deadline: it is reset by every
byte, keepalive comments included, so a healthy but quiet stream stays open
indefinitely while a connection dropped silently by a proxy is detected instead
of reading as healthy forever.
Cooldown schedule
After the live stream fails three times in a row, the SDK stops trying it for a while and relies on TTL polling.sseReconnectCooldown is how long it waits
before each subsequent attempt, in minutes:
undefined-[5, 10, 20, 40, 60]- a number, e.g.
10- a fixed ten-minute interval - an array, e.g.
[1, 2, 5]- a custom schedule that stays at its last value
