Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !12774

Fix argument `allowedHost`

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Administrator requested to merge github/fork/Manc/patch into main Oct 13, 2022
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: Manc

This PR fixes issues #12304 and #11762 – “react-scripts start fails when both HOST and proxy are defined”.

Steps to verify the issue

  • Add a proxy in package.json of a new project (if verifying within the monorepo code, use packages/react-scripts/package.json).
  • Set a HOST environment variable and run the start script, e.g: HOST=example.local yarn run start
  • The script will fail with error message: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. options.allowedHosts[0] should be a non-empty string.

After applying this patch, the script will run as expected, setting the allowedHost property of the Webpack config to the given hostname.

Explanation

The function createDevServerConfig expects the hostname as string for its second argument, but instead of HOST, urls.lanUrlForConfig is provided and its value is undefined.

It appears, this bug has been in introduced all the way back in 2017.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/Manc/patch