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

Javascript generated client triggers errors on User-Agent in browser #1020

Closed
rewop opened this issue Jan 29, 2024 · 2 comments · Fixed by #1029
Closed

Javascript generated client triggers errors on User-Agent in browser #1020

rewop opened this issue Jan 29, 2024 · 2 comments · Fixed by #1029
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@rewop
Copy link
Contributor

rewop commented Jan 29, 2024

Description of the Problem

While learning encore.dev using the uptime tutorial I found out the frontend client generates the following errors in the browser console

Refused to set unsafe header "User-Agent"

The error is thrown because the generated js client attempts to set the User-Agent and the browser doesn't allow it.

Expected Behavior

Generated JS client for browser should not attempt to set User-Agent. User-Agent should be only set when the client is used in backend services.

Environment

  • Mac Sonoma 14.2.1
  • Chrome 120.0.6099.234
@eandre
Copy link
Member

eandre commented Feb 9, 2024

Thanks @rewop. We don't have a good way of distinguishing between client generation for frontend use and for backend use at the moment, but until we do it's a better default to not send the User-Agent header. Want to submit a PR?

@eandre eandre added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Feb 9, 2024
@rewop
Copy link
Contributor Author

rewop commented Feb 12, 2024

@eandre I should have a PR today or tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants