Frontend observability troubleshooting ΒΆ
Content Security Policy (CSP) ΒΆ
If your application uses a Content Security Policy, the browser blocks Faro's requests to the collector unless you allow them.
Add the collector endpoint to connect-src:
connect-src 'self' https://telemetry.external.prod.test-nais.cloud.nais.io/ https://telemetry.external.dev.test-nais.cloud.nais.io/;Symptoms: No data appears in Grafana. Browser console shows errors like Refused to connect to '...' because it violates the following Content Security Policy directive: "connect-src ...".
CORS errors with trace propagation ΒΆ
When using trace propagation, the browser sends a traceparent header to your backend. If your backend doesn't allow this header in CORS, the request may fail or the header is silently dropped.
Symptoms: Trace propagation doesn't work (no linked backend spans), or API requests fail with CORS errors in the browser console.
Fix: Add traceparent to Access-Control-Allow-Headers on your backend:
Access-Control-Allow-Headers: Content-Type, traceparentNo data in Grafana ΒΆ
If you've deployed Faro but don't see data:
- Check the browser console β look for errors from Faro or network errors to the collector endpoint
- Check the Network tab β filter for requests to the collector URL. You should see POST requests with a
2xxresponse - Check the collector URL β make sure it matches your environment (dev vs prod). See collector endpoints
- Check CSP β see above
- Check sampling β if you set
sessionTracking.samplingRate, your session might not be sampled. Try setting it to1.0temporarily - Wait a moment β data can take up to a minute to appear in Grafana
Sourcemaps not resolving ΒΆ
If error stack traces show minified positions instead of source code:
-
Check that your app is on the CDN β sourcemap resolution only works for bundles served from
cdn.test-nais.cloud.nais.io. Server-rendered apps (Next.js, Remix) serving assets from the pod are not supported -
Check that sourcemaps are deployed β your
.mapfiles must be on the CDN alongside the JS bundle -
Check
sourceMappingURLβ open your deployed JS bundle in a browser and look for//# sourceMappingURL=at the bottom. If it's missing, check your bundler config -
Check the path β the
sourceMappingURLmight be a relative path that doesn't resolve correctly from the collector's perspective
See Sourcemaps for build configuration details.
High data volume ΒΆ
If Faro generates more data than you need:
- Reduce session sampling β set
sessionTracking.samplingRateto a value between0and1(e.g.,0.1for 10% of sessions) - Disable console capture β pass
captureConsole: falsetogetWebInstrumentations(), particularly if your app produces a lot of console output - Remove tracing β if you don't need browser traces, don't install
@grafana/faro-web-tracing. This also saves ~500kB in bundle size - Use a feature flag β only initialize Faro for a subset of users
See Performance tuning for configuration examples.
Faro not initializing ΒΆ
If initializeFaro() throws or Faro doesn't start:
- Check the import β make sure you import from
@grafana/faro-web-sdk, not a different package - Check
'use client'β in Next.js App Router, the file that callsinitializeFaromust have'use client'at the top. Faro can't run in React Server Components - Check for double initialization β if Faro is already initialized, calling
initializeFaroagain throws. Guard withif (faro.api) return; - Check bundler externals β if you use
nais.jsauto-configuration, make sure the file is excluded from bundling. Otherwise the bundler replaces it with local dev values