v1.3.2Latest

Less to wire up in production.

Two config flags put a CSP nonce and an integrity hash on Catalyst's script tags, serverSideFunction gets runInParallel, and OpenTelemetry error sampling keeps the trace of a failed request. Everything since 1.2.1.

CSP_NONCE_ENABLE and SCRIPT_INTEGRITY_ENABLE. A nonce and a hash on the script tags Catalyst renders.

runInParallel in serverSideFunction. Your work runs alongside the route fetchers.

Everything since 1.2.1, from 1.3.0, 1.3.1 and 1.3.2. These are things a production app used to wire up itself, now built in. The public API has no breaking changes, and the behaviour changes are in the full release notes below.

01 / Try it

Two flags, one argument, one option.

config/config.jsonA nonce and a hash on script tags
{
"CSP_NONCE_ENABLE": true,
"SCRIPT_INTEGRITY_ENABLE": true
}
App.serverSideFunctionRuns alongside the route fetchers
App.serverSideFunction = ({ store, req, runInParallel }) => {
runInParallel(store.dispatch(loadUser(req)))
}
server/index.jsFailed requests keep their trace
Otel.init({
samplingRate: 0.05,
errorSampling: {
ENABLED: true,
EXPORT_FULL_TRACE_ON_ERROR: true,
},
})

All of them are off until you turn them on. Details: Security, SSR Lifecycle and OpenTelemetry Integration.

02 / What's new

Secure, fast, and easy to see into.

Secure: a nonce and a hash on script tags

With CSP_NONCE_ENABLE: true, every script tag Catalyst renders carries a per-request nonce, so you can send a script-src policy without 'unsafe-inline'. Read it from res.locals.cspNonce in a middleware and put it in the Content-Security-Policy header. With SCRIPT_INTEGRITY_ENABLE: true, catalyst build hashes every built JS file and the production server adds integrity to the module script tags and modulepreload links, so the browser refuses a file that changed after the build. Files loaded later with import are not checked, and styles are not nonced. Rebuild after turning integrity on.

Fast: work alongside the fetchers

App.serverSideFunction receives runInParallel(...promises). Work passed to it runs alongside the route's serverFetcher, and both finish before the store is serialized. Apps that never call it keep the old order.

See: failed requests keep their trace

OpenTelemetry error sampling is off unless errorSampling.ENABLED is set. When it is on, unsampled traces wait in memory until the request ends, and the ones that failed are exported even when samplingRate is low. EXPORT_FULL_TRACE_ON_ERROR exports every span of a failed request instead of the root and error spans, and REPORT_ACTUAL_PROMOTION_RATE reports the real promotion rate. The server also logs a memory heartbeat.

03 / Also new

Smaller things, sorted.

  • WEBVIEW_CONFIG.ios.deviceFamily sets the devices the iOS app runs on: iphone, ipad or universal. Existing apps stay universal, and new apps from create-catalyst-app start as iphone. An App Store release that targets iPad with iPhone-only sized icons now stops at the start of the build, before App Store Connect rejects the upload.
  • WEBVIEW_CONFIG.location.enabled adds the Android location permissions and the iOS usage description, so pages in the app can use navigator.geolocation. location.usageDescription sets the iOS text.
  • A failed catalyst build prints the bundler's real error, such as a missing package, a missing export or a Sass error, instead of only BUNDLE-000 and stack frames.
  • MetaTag is the only owner of the tags from setMetaData, apart from the title. The server no longer renders them twice, and the previous page's description and canonical no longer stay after a client navigation. JSON-LD scripts now render in the page body, where MetaTag sits, because React 19 does not hoist them into the head.
  • OFFLINE_SNAPSHOTS_ENABLE: false turns off Catalyst's service worker and offline manifest, for apps that ship their own worker. See Route Offline Snapshots.

04 / Fixed

The nonce and startup do what they say.

  • With CSP_NONCE_ENABLE: true, res.locals.cspNonce is set before the app's middlewares run. In 1.3.0 and 1.3.1 a middleware that read it sent 'nonce-undefined' in the header, and the browser blocked Catalyst's inline scripts. A middleware that sets its own nonce must assign it on every request.
  • catalyst start and catalyst serve register the module loader before preServerInit runs, so a server/index.js that imports an app alias works again. This had been broken since 1.1.0, and the hook was skipped without a message.
  • A server/index.js that exists but fails to import now stops startup with the import error. It used to be skipped.

Thank you.

Catalyst 1.3.2 was built by these people.

Questions or ideas? Find us on Discord, X and GitHub Discussions.

Full release notes

Added

  • iOS device family. WEBVIEW_CONFIG.ios.deviceFamily sets the devices the iOS app runs on: iphone, ipad or universal. A config without the key stays universal, as every build was before, and new apps from create-catalyst-app start as iphone. Any other value stops the build with IOS-016. Apple does not let a published app drop iPad support, so decide before the first store release.
  • iPad icon check. The sized icons in public/ios/appIcons cover iPhone sizes only, and App Store Connect rejects an upload that targets iPad without iPad icons. An App Store release (ios.exportMethod app-store-connect, the default) that targets iPad with sized icons now stops before the archive with IOS-017. Set ios.deviceFamily to iphone, or replace the sized icons with the single public/icon.png. Other export methods get a warning, and debug builds are not checked.

Fixes

  • CSP nonce. With CSP_NONCE_ENABLE: true, res.locals.cspNonce is set before the app's middlewares run, so a middleware from addMiddlewares can read it and put it in the Content-Security-Policy header. In 1.3.0 and 1.3.1 the value was set after those middlewares, so the header carried 'nonce-undefined' and the browser blocked Catalyst's inline scripts. A middleware that sets its own nonce must assign res.locals.cspNonce every time, because the value is no longer empty when the middleware runs.