Skip to content

SDK-613: upgrade Next.js examples to 16.3.4 and add example test coverage - #135

Open
devtools-agent[bot] wants to merge 5 commits into
mainfrom
aicd-bot/sdk-613-rollbar-react-upgrade-nextjs
Open

SDK-613: upgrade Next.js examples to 16.3.4 and add example test coverage#135
devtools-agent[bot] wants to merge 5 commits into
mainfrom
aicd-bot/sdk-613-rollbar-react-upgrade-nextjs

Conversation

@devtools-agent

Copy link
Copy Markdown

SDK-613 — upgrade the Next.js examples off the vulnerable next@14.2.15

Both Next.js examples (examples/nextjs, pages router, and examples/nextjs-approuter, app router) were pinned to next@14.2.15, which is what the Dependabot alert on this repo flags. This moves both to next@16.3.4, the current major. npm audit in both examples now reports nothing against next — and the transitive postcss advisories that 15.x still carried are gone too.

Framework / runtime moves

  • react, react-dom and their @types move to 19, which is what Next 15+ App Router expects. @rollbar/react already declares 19.x support in its peer range, so no library change is needed.
  • Next 16 requires node >= 20.9, so the node: 18 leg of the CI matrix is removed and node: 22 added, keeping three versions covered.
  • outputFileTracingRoot added to both next configs so Next stops inferring the repo root as the workspace root (this repo has multiple lockfiles).
  • tsconfig jsx moves preservereact-jsx (mandated by Next 16); the app-router example also picks up the .next/dev/types include and target: ES2017 for top-level await.

Lint plumbing

Next 16 removes next lint, and eslint-config-next@16 is flat-config-only and needs ESLint >= 9. So in both examples:

  • .eslintrc.jsoneslint.config.mjs re-exporting eslint-config-next/core-web-vitals (which already carries the TypeScript setup and the .next/out/build ignores),
  • eslint ^8^9,
  • the lint script becomes eslint ..

ESLint is pinned to ^9 rather than ^10 deliberately: eslint-config-next@16 pulls eslint-plugin-react, eslint-plugin-import and eslint-plugin-jsx-a11y, none of which declare ESLint 10 support yet, so ^10 only installs behind three ERESOLVE peer overrides. The root lint:examples script keeps working unchanged — ESLint 9 still accepts --ext — and both examples lint clean via either invocation.

Test coverage for the upgrade

An examples bump with no assertions is easy to get subtly wrong, so both examples now run jest through next/jest, meaning the suites exercise the real SWC/Next transform rather than a hand-rolled babel config:

  • pages router_app renders the page with a Rollbar instance in context; a throwing page renders the ErrorBoundary fallback and reports through rollbar.critical with the configured message, extra and callback; the home page renders (which covers next/font/local and next/image under the new major).
  • app router — the async RootLayout server component wraps the document in the Rollbar Provider; next_error_handler/error.tsx reports via useRollbar and resets; the ErrorBoundary page renders.

Wired up as npm run test:examples at the root (reusing the existing scripts/foreach-example.ts, skipping examples with no test:ci script) plus a test:all, and run as a new Test examples step in CI.

Verification

Both examples build (Turbopack), lint clean, and all six new example tests pass. Library source is untouched — this PR only moves the examples and CI.

🤖 Generated with Claude Code

AI Agent and others added 2 commits September 10, 2026 05:14
The two Next.js examples were pinned to next@14.2.15, which is what the
Dependabot alert on this repo flags. Move both to next@15.5.25 (latest
fully-patched 15.x); `npm audit` no longer reports any advisory against
Next.js itself in either example.

15.x rather than 16.x: Next 16 requires node ^20.9 || >=22, which would
break the node 18 and node 21 legs of the CI matrix, and it removes
`next lint`, which both examples still use.

Alongside the bump:
- react/react-dom and their types move to 19, matching what Next 15's
  App Router expects; @rollbar/react already declares 19.x support.
- Add `outputFileTracingRoot` to both next configs so Next 15 stops
  inferring the repo root as the workspace root (multiple lockfiles).
- Add `target: ES2017` to the app-router tsconfig, as Next 15 requires
  for top-level await.

Test coverage for the upgrade — both examples now run jest via
`next/jest`, so the suites exercise the real SWC/Next transform:
- pages router: `_app` renders the page with a Rollbar instance in
  context, and a throwing page renders the ErrorBoundary fallback and
  reports through `rollbar.critical` with the configured message, extra
  and callback; the home page renders (covers next/font/local and
  next/image under Next 15).
- app router: the async `RootLayout` server component wraps the document
  in the Rollbar Provider, `next_error_handler/error.tsx` reports the
  error via `useRollbar` and resets, and the `ErrorBoundary` page renders.

Wired up as `npm run test:examples` (skips examples without a `test:ci`
script) and run as a new CI step.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Follow-up to the 15.5.25 bump: go all the way to the current Next.js
major. `npm audit` in both examples now reports nothing against `next`
at all (the transitive `postcss` advisories 15.x carried are gone too).

Next 16 requires node >= 20.9, so the node 18 leg of the CI matrix is
removed; node 22 is added so the matrix still covers three versions.

Next 16 also removes `next lint`, and `eslint-config-next@16` is
flat-config only and needs ESLint >= 9. So both examples:
- replace `.eslintrc.json` with `eslint.config.mjs` re-exporting
  `eslint-config-next/core-web-vitals` (which already carries the
  TypeScript setup and the .next/out/build ignores),
- move eslint 8 -> 9, and
- change their `lint` script from `next lint` to `eslint .`.

ESLint is pinned to ^9 rather than ^10 deliberately: eslint-config-next
16 pulls eslint-plugin-react, eslint-plugin-import and
eslint-plugin-jsx-a11y, none of which declare ESLint 10 support yet, so
^10 only installs behind three ERESOLVE peer overrides.

The root `lint:examples` script still works unchanged -- ESLint 9 still
accepts `--ext` -- and both examples lint clean via either invocation.

tsconfig `jsx` moves from `preserve` to `react-jsx`, which Next 16
mandates, and the app-router example picks up the `.next/dev/types`
include.

Verified: both examples build (Turbopack), lint clean, and all six
example tests added for this upgrade still pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Sep 10, 2026

Copy link
Copy Markdown

SDK-613

AI Agent and others added 2 commits September 10, 2026 19:49
The `Install` step (`npm run install:all -- ci`) failed on all three CI
legs:

    npm error `npm ci` can only install packages when your package.json
    and package-lock.json ... are in sync.
    npm error Invalid: lock file's @rollbar/react@1.0.0+7da6e313 does
    not satisfy @rollbar/react@1.0.0+d49a5d31

The two lockfiles regenerated for the Next 16 bump recorded
`@rollbar/react` as a *copied* dependency:

    "node_modules/@rollbar/react": {
      "version": "1.0.0+7da6e313",
      "resolved": "file:.yalc/@rollbar/react", ...

That happens under npm 9, whose default for `install-links` is `true`
(npm 10 reverted it to `false`). In copy mode npm pins the version of
the `file:` dependency -- and `install-all.js` publishes the package
with `yalc publish --sig`, so that version carries a build signature
that differs on every machine. Any such lockfile can only ever be
installed on the box that generated it.

Regenerated both with npm 10 / `install-links=false`, which restores
the link form the other examples and `main` already use:

    "node_modules/@rollbar/react": {
      "resolved": ".yalc/@rollbar/react",
      "link": true

The signature now only appears on the `.yalc/@rollbar/react` entry,
which `npm ci` does not verify -- confirmed by rewriting the local
signature to a bogus value and re-running `npm ci`, which succeeds
(main's lockfiles have carried a stale `0.12.0-beta+5817c339` there for
several releases for the same reason).

No dependency versions change. Verified after reinstalling both
examples in link mode: `npm ci`, `eslint .`, `next build` and all six
example tests pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ions

The new node 22 CI leg failed at the library build:

    > rollup --config
    [!] SyntaxError: Unexpected identifier 'assert'

`rollup.config.mjs` read the version/entry paths from package.json via
`import pkg from './package.json' assert { type: 'json' }`. Node 22
removed the `assert` import-attribute syntax (V8 kept only `with`), so
the config no longer parses there. Nothing in the library itself is
affected -- only this build config, and only on node >= 22.

Switched to `createRequire(import.meta.url)('./package.json')` rather
than `with { type: 'json' }`: `with` only exists from node 20.10 (and
18.20) on, whereas `createRequire` parses and runs on every version,
so nobody's local node breaks either way.

Verified by running the full CI sequence locally on node 22.23.2 with
npm 10.9.9 -- the exact pair the failing leg uses: `install:all -- ci`,
`lint`, `lint:examples`, `build:all` (all four examples) and both test
suites pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@brianr brianr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two CI concerns to address before merging:

Comment thread .github/workflows/ci.yaml
Comment thread .github/workflows/ci.yaml Outdated
Addresses both review comments on the CI workflow.

`continue-on-error: true` sat on the `build` job, so every matrix leg
could fail while the run still reported success -- the reason the
`npm ci` breakage in this branch showed up as a green run. Removed it,
so a regression in `Lint`, `Build`, `Test` or the new `Test examples`
step now fails CI. `strategy.fail-fast: false` takes its place, which
is what the original setting was presumably reaching for: every runtime
still reports instead of being cancelled by the first failure.

Node 21 has been end-of-life since June 2024, so that slot becomes node
24 (paired with npm 11, the version it bundles). The matrix is now node
20 -- the floor Next.js 16 supports, and what the examples pin -- plus
the two maintained LTS lines, 22 and 24.

Verified: the full CI sequence (`install:all -- ci`, `lint`,
`lint:examples`, `build:all` across all four examples, `test`,
`test:examples`) passes locally on node 24.21.0 with npm 11, as it
already does on 22.23.2 with npm 10.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@brianr
brianr self-requested a review September 10, 2026 20:40
@brianr brianr self-assigned this Sep 10, 2026
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