Skip to content

Fonts intermittently don't load in development environment #61

Closed
@jbritain

Description

@jbritain

Sometimes when running yarn dev, the console throws up the following errors

FetchError: request to https://fonts.googleapis.com/css2?family=Rubik:[email protected]&display=swap failed, reason: 
    at ClientRequest.<anonymous> (/home/joshua/Documents/Programming/frontend/node_modules/next/dist/compiled/node-fetch/index.js:1:65756)
    at ClientRequest.emit (node:events:511:28)
    at TLSSocket.socketErrorListener (node:_http_client:495:9)
    at TLSSocket.emit (node:events:511:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
    at runNextTicks (node:internal/process/task_queues:64:3)
    at listOnTimeout (node:internal/timers:540:9)
    at process.processTimers (node:internal/timers:514:7) {
  type: 'system',
  errno: 'ENETUNREACH',
  code: 'ENETUNREACH'
}
- error Failed to download `Rubik` from Google Fonts. Using fallback font instead.
FetchError: request to https://fonts.googleapis.com/css2?family=Orbitron:[email protected]&display=swap failed, reason: 
    at ClientRequest.<anonymous> (/home/joshua/Documents/Programming/frontend/node_modules/next/dist/compiled/node-fetch/index.js:1:65756)
    at ClientRequest.emit (node:events:511:28)
    at TLSSocket.socketErrorListener (node:_http_client:495:9)
    at TLSSocket.emit (node:events:511:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
    at runNextTicks (node:internal/process/task_queues:64:3)
    at process.processTimers (node:internal/timers:511:9) {
  type: 'system',
  errno: 'ENETUNREACH',
  code: 'ENETUNREACH'
}
- error Failed to download `Orbitron` from Google Fonts. Using fallback font instead.

The result of this is that the site resorts to using the default serif font, as shown
image

Apart from the fact that the fonts don't load, we ought to also ensure that the fallback font is a sans serif font as opposed to a serif one.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

🎉 Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions