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.
{"CSP_NONCE_ENABLE": true,"SCRIPT_INTEGRITY_ENABLE": true}
App.serverSideFunction = ({ store, req, runInParallel }) => {runInParallel(store.dispatch(loadUser(req)))}
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.deviceFamilysets the devices the iOS app runs on:iphone,ipadoruniversal. Existing apps stay universal, and new apps fromcreate-catalyst-appstart asiphone. 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.enabledadds the Android location permissions and the iOS usage description, so pages in the app can usenavigator.geolocation.location.usageDescriptionsets the iOS text.- A failed
catalyst buildprints the bundler's real error, such as a missing package, a missing export or a Sass error, instead of onlyBUNDLE-000and stack frames. MetaTagis the only owner of the tags fromsetMetaData, 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, whereMetaTagsits, because React 19 does not hoist them into the head.OFFLINE_SNAPSHOTS_ENABLE: falseturns 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.cspNonceis 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 startandcatalyst serveregister the module loader beforepreServerInitruns, so aserver/index.jsthat 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.jsthat 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.deviceFamilysets the devices the iOS app runs on:iphone,ipadoruniversal. A config without the key stays universal, as every build was before, and new apps fromcreate-catalyst-appstart asiphone. 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/appIconscover iPhone sizes only, and App Store Connect rejects an upload that targets iPad without iPad icons. An App Store release (ios.exportMethodapp-store-connect, the default) that targets iPad with sized icons now stops before the archive with IOS-017. Setios.deviceFamilytoiphone, or replace the sized icons with the singlepublic/icon.png. Other export methods get a warning, and debug builds are not checked.
Fixes
- CSP nonce. With
CSP_NONCE_ENABLE: true,res.locals.cspNonceis set before the app's middlewares run, so a middleware fromaddMiddlewarescan read it and put it in theContent-Security-Policyheader. 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 assignres.locals.cspNonceevery time, because the value is no longer empty when the middleware runs.