Interface: DebugOptions
Granular debug controls. Defaults are minimal so opting into a single
dimension does not flood the console — pass 'verbose' (or set
process.env.DOSWIFTLY_SDK_DEBUG=verbose) to switch every dimension on.
The shape is intentionally a plain object — no enum / class — so future
additions stay additive (bodyMaxBytes, redact, pretty, …).
Properties
headers?
optionalheaders?:boolean
Log request headers (sent) and response headers (received). Authorization and customerAccessToken are auto-redacted to ***<last4>. Default false.
log?
optionallog?: (event) =>void
Custom logger sink. Default console.log('[StorefrontSDK]', event.phase, event.operationName, event.data). Use for routing into pino / winston.
Parameters
event
Returns
void
remote?
optionalremote?:boolean|RemoteDebugOptions|RemoteDebugSink
Ship debug events to a remote ingest endpoint, in addition to the local log sink.
Pass true to use defaults, or a RemoteDebugOptions object to customise the endpoint and
batching. Events are buffered and sent with fetch (with keepalive on page-unload flushes so
trailing events survive a navigation); a failed send is swallowed so telemetry can never break
the request that produced it. Cookies are not sent (credentials: 'omit'). Default false.
Redaction note: the SDK masks Authorization / customerAccessToken in headers. It does NOT
redact the request variables or response body it ships — the backend ingest endpoint is the
safety net there (it masks emails and credential-named fields). Enable response / headers
only for operations whose payload you are comfortable sending to your backend.
Which events are shipped is governed by the other flags above — remote: true alone ships the
minimal set (request variables + response status + userErrors); enable response / headers
/ timing to ship more.
Pass a pre-built transport (a RemoteDebugSink, e.g. from createRemoteDebugTransport) to
share ONE channel + sessionId across the GraphQL client and the cookie stores, so a single
sessionId in your logs gives the full interleaved timeline (GraphQL + cookie set/clear).
request?
optionalrequest?:boolean
Log the full GraphQL query document on every request. Default false — variables are always logged.
response?
optionalresponse?:boolean
Log the full response body (data + errors + extensions) on every response. Default false.
timing?
optionaltiming?:boolean
Log request duration (durationMs) on every response. Default false.
userErrors?
optionaluserErrors?:boolean
Surface userErrors[] from mutation payloads as a flat array on the response log. Default true — the most common diagnostic.