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

RangeError: Invalid typed array length: -4095 #35

Closed
asos-albinotonnina opened this issue Jan 29, 2020 · 1 comment
Closed

RangeError: Invalid typed array length: -4095 #35

asos-albinotonnina opened this issue Jan 29, 2020 · 1 comment

Comments

@asos-albinotonnina
Copy link

Bug description
As you stated in the README, I'm getting this error only when ENV=production.
I do need that because I'm trying this tool, which looks great, for performance tests.
Reason why I'm opening this issue is that I'm running node 12.14, which is fairly new!

To Reproduce

server.js

const app = require("https-localhost")();
app.get("/", function(req, res) {
  res.send(`hello, http2`);
});

app.listen(4000);
NODE_ENV=production node ./server.js

Expected behavior
not RangeError: Invalid typed array length: -4095

System information (please complete the following information):

  • OS: MacOS Catalina
  • App version 4.4.1
  • Node version 12.14
@daquinoaldo
Copy link
Owner

Hi @asos-albinotonnina!

This is a known bug of the spdy library. This is the reason I don't use http2 by default but only in production mode. Unfortunately, there aren't any news about a possible fix neither we know under which conditions it occurs. I'm not able to reproduce the bug to fix the library.

At the moment, the only fix is to avoid the production environment. If you need production in you context you can workaround in the following way.

const nodeEnv = process.env.NODE_ENV;
process.env.NODE_ENV = "development";
const app = require("https-localhost")();
process.env.NODE_ENV = nodeEnv;

In version 5 of https-localhost I planned to stop using express. This will allow to use the new built-in http2 instead of spdy, since express doesn't support http2 yet.
Hopefully, v5 should come in March 2020.

If you don't need express either, take a look to Use with a web framework different from Express.js. Just use http2 instead of https in the example code.
There are no changes that you can use express in this way, but take a look to koajs, it should work and it is newer and lighter.

Feel free to reopen this issue if my answer does not satisfy your questions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants