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

browser-esbuild builder is not validating proxy.conf.json #25978

Closed
1 task done
zip-fa opened this issue Oct 7, 2023 · 1 comment · Fixed by #25989
Closed
1 task done

browser-esbuild builder is not validating proxy.conf.json #25978

zip-fa opened this issue Oct 7, 2023 · 1 comment · Fixed by #25989

Comments

@zip-fa
Copy link

zip-fa commented Oct 7, 2023

Command

serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

webpack browser builder

Description

Hi. I have invalid proxy.conf.json file, with this content:

{
  "/cdn": {
    "target": "https://website.com",
    "secure": false,
    "changeOrigin": true,
    "logLevel": "debug"
  },
  "changeOrigin": true
}

Look at the "changeOrigin": true at the end.
It was in my project since angular v8, and now it breaks with esbuild.
I removed this line after i finally realised what caused ng serve to fail. Maybe there should be some kind of validation before starting dev server?

Minimal Reproduction

https://stackblitz.com/edit/angular-at-dwjtto?file=proxy.conf.json

Exception or Error

TypeError: Cannot use 'in' operator to search for 'pathRewrite' in true
    at normalizeProxyConfiguration (/node_modules/@angular-devkit/build-angular/src/builders/dev-server/load-proxy-config.js:146:27)
    at loadProxyConfiguration (/node_modules/@angular-devkit/build-angular/src/builders/dev-server/load-proxy-config.js:98:30)
    at async setupServer (/node_modules/@angular-devkit/build-angular/src/builders/dev-server/vite-server.js:232:19)
    at async serveWithVite (/node_modules/@angular-devkit/build-angular/src/builders/dev-server/vite-server.js:118:41)

Your Environment

Angular: 17.0.0-next.7
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.0-next.7
@angular-devkit/build-angular   17.0.0-next.7
@angular-devkit/core            17.0.0-next.7
@angular-devkit/schematics      17.0.0-next.7
@angular/cdk                    17.0.0-next.5
@angular/material               17.0.0-next.5
@schematics/angular             17.0.0-next.7
rxjs                            7.4.0
typescript                      5.2.2
zone.js                         0.13.0

Anything else relevant?

No response

clydin added a commit to clydin/angular-cli that referenced this issue Oct 9, 2023
…rmalization when invalid value

When normalizing the proxy configuration for the Vite-based development server, the `pathRewrite` logic
will now be skipped if the proxy entry is not an object and therefore invalid. This situation can occur
if the proxy configuration JSON contains invalid properties.

Closes angular#25978
alan-agius4 pushed a commit that referenced this issue Oct 9, 2023
…rmalization when invalid value

When normalizing the proxy configuration for the Vite-based development server, the `pathRewrite` logic
will now be skipped if the proxy entry is not an object and therefore invalid. This situation can occur
if the proxy configuration JSON contains invalid properties.

Closes #25978
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants