Skip to content

Tolerate configs without the newer server middleware options (fix accidental breaking change) - #2099

Closed
robhogan wants to merge 1 commit into
mainfrom
pr2099
Closed

robhogan wants to merge 1 commit into
mainfrom
pr2099

Conversation

@robhogan

@robhogan robhogan commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

#2031 added server.unstable_onServerCreated, unstable_priorityMiddleware and unstable_middleware, which createConnectMiddleware assumes are set. A config from an older metro-config, or built by hand, crashes runServer:

TypeError: config.server.unstable_onServerCreated is not a function

This treats them as optional.

Changelog: Internal

Test plan:

  • New integration test, failing without this change.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 23, 2026
#2031 added `server.unstable_onServerCreated`, `unstable_priorityMiddleware` and `unstable_middleware`, which `createConnectMiddleware` assumes are set. A config from an older `metro-config`, or built by hand, crashes `runServer`:

```
TypeError: config.server.unstable_onServerCreated is not a function
```

This treats them as optional.

Changelog: Internal

Test plan:
- New integration test, failing without this change.
@robhogan robhogan changed the title Tolerate configs without the newer server middleware options Tolerate configs without the newer server middleware options (fix accidental breaking change) Oct 23, 2026
@robhogan

Copy link
Copy Markdown
Collaborator Author

Not needed: loadConfig (RN CLI) and @expo/metro-config's getDefaultConfig (Expo) both merge over this Metro's own defaults, so the new server options are always set, even for a config built with an older metro-config. Only a config loaded by a different metro-config copy and passed straight to runServer can miss them, and neither CLI does that.

@robhogan robhogan closed this Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant