Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development server error when proxy configuration is added to package.json #11795

Closed
dxataclub opened this issue Dec 17, 2021 Discussed in #11788 · 1 comment
Closed

Development server error when proxy configuration is added to package.json #11795

dxataclub opened this issue Dec 17, 2021 Discussed in #11788 · 1 comment

Comments

@dxataclub
Copy link

Discussed in #11788

Originally posted by petal-person December 16, 2021
Platform: Ubuntu
Cra & react-scripts Version: 5.0.0
NodeJS Version: v16.13.1
NPM Version: 8.3.0

Okay so, whenever I add the proxy configuration to my package.json I get an error. But without it, the project compiles & the server starts just fine.

This is the terminal with the error:

> app@0.1.0 start
> react-scripts start

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.

This even happens on a plain boilerplate project. this is what my package.json looks like:

{
  "name": "app",
  "proxy": "http://localhost:3001", //the error only occurs when this is here..
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.1",
    "@testing-library/react": "^12.1.2",
    "@testing-library/user-event": "^13.5.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "5.0.0",
    "web-vitals": "^2.1.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

I'm trying to figure out what the problem is, I don't know if it's with my server or something in react...

Any help is appreciated :)

@raix
Copy link
Contributor

raix commented Dec 18, 2021

@petal-person thanks for reporting the issue, seems like we have an issue in the WDS configuration in some cases, closing this in favor of #11762

@raix raix closed this as completed Dec 18, 2021
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

No branches or pull requests

2 participants