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.

Enable experimental feature http2

See original GitHub issue

Hello,

I’ve got this error when i want to use superagent to send an API request :

superagent: Enable experimental feature http2
(node:20298) ExperimentalWarning: The http2 module is an experimental API.
(node:20298) UnhandledPromiseRejectionWarning: Error: Unauthorized
    at Request.callback (/home/admin/www/imf-nodeapps/node_modules/superagent/lib/node/index.js:783:15)
    at IncomingMessage.parser (/home/admin/www/imf-nodeapps/node_modules/superagent/lib/node/index.js:1015:18)
    at emitNone (events.js:106:13)
    at Stream.emit (events.js:208:7)
    at Unzip.unzip.on (/home/admin/www/imf-nodeapps/node_modules/superagent/lib/node/unzip.js:55:12)
    at emitNone (events.js:111:20)
    at Unzip.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
(node:20298) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:20298) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code

do you have any ideas what i have to do?

thanks

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
kornelskicommented, Oct 31, 2018

OK, I’ve checked the code:

Ignore the HTTP2 line. It’s always printed on Node 10 and later. It’s not an error, and it doesn’t mean anything.

The error is about lack of .catch() in your code.

Your problem is only later “UnhandledPromiseRejectionWarning: Error: Unauthorized”. That means you have made HTTP request to a server, but the server returned status 403, and you’ve ignored that error by not having .catch() in your code.

Every time you use .then(), you must also catch Promise errors (i.e. have .catch() somewhere later, or 2-argument version of .then(), or use async/await syntax instead of then()).

When you launch node, add --trace-warnings, e.g.

node --trace-warnings index.js

and it will show you where you must add .catch() calls.

2reactions
kornelskicommented, Nov 15, 2018

It’s disabled on master

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enable experimental feature http2 · Issue #1430 - GitHub
Hello, I've got this error when i want to use superagent to send an API request : superagent: Enable experimental feature http2 (node:20298) ......
Read more >
adonis test returning message: "superagent: Enable ...
My testing is passing normally, but i'm receiving the message: “superagent: Enable experimental feature http2”.
Read more >
HTTP/2 guide - Apache HTTP Server Version 2.5
This is the howto guide for the HTTP/2 implementation in Apache httpd. This feature is production-ready and you may expect interfaces and directives...
Read more >
HTTP/2 | Node.js v19.3.0 Documentation
Used to set a callback function that is called when there is no activity on the Http2Session after msecs milliseconds. The given callback...
Read more >
Introduction to HTTP/2 - web.dev
HTTP/2 (or h2) is a binary protocol that brings push, multiplexing streams and frame control to the web.
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