question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Default fetch polyfill breaks ky-universal

See original GitHub issue

Bug report

I use ky-universal, which is built on top of node-fetch. After upgrading to Next.js 9.4, it has started throwing "Only absolute URLs are supported" errors on the Node.js side, even though an absolute URL is set and it works on Next.js 9.3.x.

To Reproduce

  1. Use ky-universal in a Next.js project to make a request on the server side.
  2. Watch it throw a "Only absolute URLs are supported" error.

Expected behavior

Shouldn’t throw an error, and should work like it did in Next.js 9.3.x.

System information

  • OS: macOS
  • Version of Next.js: 9.4.0
  • Version of Node.js: 14.1.0

Additional context

It looks like the default polyfill is interfering with the library somehow, but I can’t figure out what/how. Also, pasting from https://github.com/zeit/next.js/pull/12353#issuecomment-627064091

node-fetch has an upcoming v3 release (in beta now) that fixes a long-standing issue, and ky-universal is in the process of using it in their next release, which is vital when working with large API payloads.

Similar reports —

  1. https://github.com/zeit/next.js/pull/12353#issuecomment-625114086
  2. https://github.com/zeit/next.js/discussions/12732

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
paambaaticommented, May 13, 2020

@timneutkens Thanks, I can confirm that this is fixed and ky-universal works fine on 9.4.1-canary.1.

2reactions
timneutkenscommented, May 12, 2020

Hey! Thanks for the report, I’ve fixed the issue here: #12804

Read more comments on GitHub >

github_iconTop Results From Across the Web

fetch polyfill breaks ky-universal #12761 - vercel/next.js - GitHub
Default fetch polyfill breaks ky-universal #12761 ... Use ky-universal in a Next.js project to make a request on the server side.
Read more >
Ky-universal: Universal HTTP Client Based on Fetch - Morioh
For older browsers, you will need to transpile and use a fetch polyfill. ... When using Ky, the default highWaterMark is set to...
Read more >
Polyfilling the Fetch API for Old Browsers and Node.js
First some definitions. A polyfill will try to emulate certain APIs, so can use them as if they were already implemented. A transpiler...
Read more >
wretch - npm Package Health Analysis - Snyk
A tiny wrapper built around fetch with an intuitive syntax. For more information about how to use this package see README · Ensure...
Read more >
axios Alternatives - Node.js HTTP | LibHunt
9.6 0.0 L3 axios VS window.fetch polyfill ... ky-universal ... const axios = require('axios').default; // Make a request for a user with a ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found