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

[NEXT-690] @next/font does not respect https_proxy environment variable #45034

Closed
1 task done
tom-h10 opened this issue Jan 19, 2023 · 2 comments · Fixed by #46822
Closed
1 task done

[NEXT-690] @next/font does not respect https_proxy environment variable #45034

tom-h10 opened this issue Jan 19, 2023 · 2 comments · Fixed by #46822
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team.

Comments

@tom-h10
Copy link

tom-h10 commented Jan 19, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Pro
Binaries:
  Node: 18.12.1
  npm: 9.2.0
  Yarn: N/A
  pnpm: N/A
Relevant packages:
  next: 13.1.2
  eslint-config-next: 13.1.2
  react: 18.2.0
  react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

Font optimization (@next/font)

Link to the code that reproduces this issue

N/A

To Reproduce

  1. npx create-next-app
  2. An app including @next/font will be created
  3. npm run dev behind a corporate proxy (with https_proxy environment variable)
  4. Access to http://localhost:3000/

Describe the Bug

Failed to fetch the font.

Dev server output:

ready - started server on 0.0.0.0:3000, url: http://localhost:3000
event - compiled client and server successfully in 6.6s (165 modules)
wait  - compiling / (client and server)...
Error [NextFontError]: Failed to fetch `Inter` from Google Fonts.
    at nextFontError (...\node_modules\@next\font\dist\utils.js:55:17)
    at downloadGoogleFonts (...\node_modules\@next\font\dist\google\loader.js:87:39)   
    at ...\node_modules\next\dist\build\webpack\loaders\next-font-loader\index.js:52:99
    at async Span.traceAsyncFn (...\node_modules\next\dist\trace\trace.js:79:20)       
error - Failed to download `Inter` from Google Fonts. Using fallback font instead.
event - compiled client and server successfully in 1023 ms (194 modules)

Expected Behavior

Respect the https_proxy environment variable, and the font should be successfully retrieved.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

NEXT-690

@tom-h10 tom-h10 added the bug Issue was opened via the bug report template. label Jan 19, 2023
@github-actions github-actions bot added the linear: next Confirmed issue that is tracked by the Next.js team. label Jan 19, 2023
@xgqfrms

This comment was marked as off-topic.

@timneutkens timneutkens added linear: next Confirmed issue that is tracked by the Next.js team. and removed linear: next Confirmed issue that is tracked by the Next.js team. labels Feb 28, 2023
@timneutkens timneutkens changed the title @next/font does not respect https_proxy environment variable [NEXT-690] @next/font does not respect https_proxy environment variable Feb 28, 2023
ijjk pushed a commit that referenced this issue Mar 8, 2023
When fetching CSS or font files from Google Fonts, it won't work if
you're required to use a proxy. This change makes it look for the
`http(s)_proxy` environment variable, and if it's defined it creates a
fetch agent using
[https-proxy-agent](https://github.com/TooTallNate/node-https-proxy-agent).

Also fixes fetch errors not being properly logged.

Fixes #45034
Closes NEXT-690

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
@github-actions
Copy link
Contributor

github-actions bot commented Apr 8, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants