Skip to content

fix: pin @grafana/faro-web-sdk to 2.11.0 (CORS regression on dev-gcp) - #87

Merged
sindrerh2 merged 1 commit into
mainfrom
fix/pin-faro-web-sdk-2.11.0
Sep 24, 2026
Merged

sindrerh2 merged 1 commit into
mainfrom
fix/pin-faro-web-sdk-2.11.0

Conversation

@sindrerh2

Copy link
Copy Markdown
Contributor

Problem

Multiple teams reported CORS preflight failures on dev-gcp when calling
https://telemetry.ekstern.dev.nav.no/collect:

Access to fetch at 'https://telemetry.ekstern.dev.nav.no/collect' from origin
'https://borger.ansatt.dev.nav.no' has been blocked by CORS policy: Response to
preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin'
header is present on the requested resource.

The origin was correctly allowlisted server-side (verified via direct curl
preflight tests). The actual cause: @grafana/faro-web-sdk@2.12.0 (pulled in
transitively via @nais/apm's previous ^2.11.0 range, and directly bumped to
^2.12.0 on main by dependabot in #84) unconditionally sends an
Idempotency-Key request header on every request as of
grafana/faro-web-sdk#2264
("make reliable Fetch transport the default"), with no opt-out.

The Alloy faro.receiver component nais runs (via nais/helm-charts
features/alloy-faro) hardcodes its allowed CORS request headers in Go and does
not yet include idempotency-key. That fix
(grafana/alloy@a6e19ce, merged
2026-09-09) has only shipped in the unreleased v1.20.0-rc.0 — no stable Alloy
release contains it yet, including the 1.12.1 currently pinned in
features/alloy-faro/Chart.yaml.

Per the Fetch CORS spec,
when any header in Access-Control-Request-Headers isn't in the receiver's
allowlist, the entire preflight is aborted — no Access-Control-Allow-Origin
is set at all, even though the origin itself is valid. This makes a header
allowlist problem look exactly like an origin allowlist problem.

Fix

Pin @grafana/faro-web-sdk (dependency) and @grafana/faro-react
(devDependency, used only for our own peer-compatibility tests) to the exact
2.11.0 release — the last version before the unconditional Idempotency-Key
header was introduced.

Verification

  • pnpm test — 244/244 tests pass
  • pnpm build — succeeds
  • Manually reproduced the failing preflight against
    https://telemetry.ekstern.dev.nav.no/collect with
    Access-Control-Request-Headers: content-type,idempotency-key,x-faro-session-id
    → 204 with no Access-Control-Allow-Origin. Removing idempotency-key from
    the request restores the header, confirming this is header- not origin-related.

Follow-up

Un-pin once nais's Alloy deployment is confirmed upgraded past v1.20.0 in all
clusters (or a backported patch release ships idempotency-key support earlier).

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

faro-web-sdk 2.12.0 (via PR grafana/faro-web-sdk#2264, 'make reliable
Fetch transport the default') unconditionally sends an Idempotency-Key
header on every request, with no opt-out. The Alloy faro.receiver
component deployed on nais clusters hardcodes its allowed CORS request
headers and does not yet include idempotency-key — that fix
(grafana/alloy@a6e19ce) has only shipped in the unreleased v1.20.0-rc.0,
not in any stable Alloy release nais currently runs.

Because the browser Fetch spec aborts the entire CORS preflight (no
Access-Control-Allow-Origin at all) when any requested header isn't in
the receiver's allowlist, apps pulling in faro-web-sdk 2.12.0 transitively
via @nais/apm's previous ^2.11.0 range see a CORS failure that looks like
a missing origin allowlist entry, even though the origin itself is
correctly configured.

Pin @grafana/faro-web-sdk (dependency) and @grafana/faro-react (devDependency,
used for our own test/peer compatibility checks) to the exact 2.11.0 release
until nais's Alloy deployment is upgraded past v1.20.0. Un-pin once collector
CORS support for Idempotency-Key is confirmed live in all clusters.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sindrerh2
sindrerh2 added this pull request to the merge queue Sep 24, 2026
Merged via the queue into main with commit 3805e49 Sep 24, 2026
6 checks passed
@sindrerh2
sindrerh2 deleted the fix/pin-faro-web-sdk-2.11.0 branch September 24, 2026 09:03
mbolstad added a commit to navikt/k9-los-web that referenced this pull request Sep 29, 2026
Samler Dependabot-PR-ene #4385, #4386, #4391, #4395, #4398, #4400, #4403
og #4406, med ett unntak: @grafana/faro-react blir på 2.11.0.

@nais/apm er bumpet til 0.7.2, som låser faro-web-sdk til 2.11.0.
faro-web-sdk 2.12 sender en Idempotency-Key-header som telemetri-
collectoren ikke tillater i CORS, så all telemetri blir blokkert
(nais/apm#87).

Overrides i pnpm-workspace.yaml låser hele Faro-familien til 2.11.0.
Uten dem løftet React-bumpen faro-reacts ^-ranges til 2.12.1, og appen
fikk to faro-core-instanser. ApmErrorBoundary og ApmRoutes rapporterte
da til en no-op-instans.

biome.json peker på schema for 2.5.14.
@sindrerh2 sindrerh2 mentioned this pull request Oct 2, 2026
sindrerh2 added a commit that referenced this pull request Oct 2, 2026
- **ci(release): sync beta from main (#45)**
- **fix(release): restrict beta manual publishing (#47)**
- **fix(release): clarify beta release flows (#49)**
- **fix(release): target beta branch (#55)**
- **fix(release): enable beta prerelease versioning (#58)**
- **fix(release): accept valid beta versions (#61)**
- **chore: promote beta to main (#75)**
- **chore: trigger release-please rerun (#78)**
- **chore(main): release apm 0.7.0 (#48)**
- **fix(deps): exclude major bumps from npm-all Dependabot group (#81)**
- **chore(main): release apm 0.7.1 (#83)**
- **chore(deps-dev): bump the npm-all group across 1 directory with 8
updates (#85)**
- **chore(deps): bump the faro group across 1 directory with 3 updates
(#84)**
- **fix: pin @grafana/faro-web-sdk to 2.11.0 (CORS regression on
dev-gcp) (#87)**
- **chore(main): release apm 0.7.2 (#89)**
- **chore(deps): bump the faro group with 3 updates (#91)**
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