Comments (44)
npm cache clean --force
from compress.
In my case, after making a npm cache clean --force
, everything works again.
from compress.
Confirmed, this is still happening. Quite interestly enough, this does not happen with CURL. I'll see if I can track this down (it might take a while).
It seems a different one than nodejs/node#13850.
from compress.
In my case, i found solution by changing order of compress and conditional-get middleware
app.use(compress({
flush: require('zlib').Z_SYNC_FLUSH
}))
.use(conditional())
.use(etag())
from compress.
Still experiencing this in 8.1.2. I don't have conditional-get
middleware.
from compress.
node v8.1.3 still same issue
const app = new Koa();
const conditional = require('koa-conditional-get');
const etag = require('koa-etag');
const compress = require('koa-compress');
const serveStatic = require('koa-static');
app.use(conditional())
app.use(etag())
app.use(compress())
app.use(serveStatic('public'))
app.use(async(ctx, next) => {
ctx.type = 'text/html';
ctx.body = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="/test.css">
</head>
<body>
Response OK
</body>
</html>`;
})
app.listen(3000)
Don't forget to include test css with some content to public dir
from compress.
Here is the fix: nodejs/node#14330
from compress.
Can you check if nodejs/node#13850 this solves the issue?
from compress.
I don't use conditional get or etag and still see this issue (with node 8.1.3 and even using Z_SYNC_FLUSH). I'm using koa-webpack middleware though.
from compress.
This should be definitely fixed in Node 8.2.1.
from compress.
Confirmed. I get this issue with Node v8 as well.
from compress.
Anyone taking this? Can someone point me to where I should look?
from compress.
Notice node 8.1 fixes something in zlib. Is this related?
A regression in the Zlib module that made it impossible to properly subclasses zlib.Deflate and other Zlib classes has been fixed. [6aeb555cc4] #13374.
from compress.
This still occurs in Node v8.1.0.
from compress.
Same issue, v8.0.0
from compress.
@jonathanong could you please take a look?
from compress.
i've seen this before. i haven't investigated it yet. it is one of the blockers for me to upgrading to node 8.
from compress.
anyone found a fix for this? also, is there an alternative middleware?
from compress.
is it because you are using Z_SYNC_FLUSH
? what happens if you don't use a flush parameter?
from compress.
e50d15f seems okay to me.
anyone else have any ideas?
from compress.
@jonathanong without flush parameter i have same result but if koa-compress middleware over conditional-get middleware everything okay. Looks like this issue happening only when we use conditional-get middleware.
from compress.
okay, i think the time i saw this error was with v8.0.0
. i don't see it anymore with the latest node
from compress.
It seems 8.1.2 fixes it. Any idea what causes this in the first place?
from compress.
I have same issue in 8.1.2 but with conditional-get middleware. I see this issue once more when my stream was broken.
from compress.
can anyone make a PR with a failing test casE?
from compress.
Node 8.1.3 fixes the issue.
from compress.
8.1.3 works for me as well
from compress.
closing. thanks @mcollina !
from compress.
I'll be happy to have a look, if you can post an example to reproduce the issue consistently.
from compress.
@mcollina you can try my example only install deps and run this app then visit page and reload it! After reloading you can see this message in your console
- I am using Marko.js and i streaming response to ctx.body but if i have error in my template file i also see this error message.
from compress.
@mcollina My setup is bit complicated but @Eldar-X setup will do.
from compress.
@Eldar-X @mrchief I cannot reproduce with node 8.1.2, 8.1.3, 8.1.4 or master using your example on Mac OS X 10.11 and Chrome.
from compress.
Could the OS be a factor? I'm on Windows 7 x64. Even in my setup, I don't get it consistently. E.g., I ran my app right now and there were no errors. Then I refreshed the page and saw this error. And sometimes it happens many times within the same request.
I'll try to upload my setup tonight.
from compress.
@mcollina i am also on Mac Os 10.11
from compress.
https://github.com/Eldar-X/koa-issue my simple setup
from compress.
Now I cannot reproduce anymore. However, the same node version/code was showing the problem while I was traveling (and I could not work on it). If someone has a consistent way of reproducing this problem, please let me know.
from compress.
I can reproduce by loading the server with autocannon:
autocannon -H Accept-Encoding=gzip -c 100 -d 5 localhost:3000
from compress.
Will you be adding a regression test for this? Then maybe apply for addition to node's CitGM
from compress.
@jonathanong if you could write a regression test for this. It's literally keeping up at night 😨
from compress.
@refack im not sure what the test case is...
from compress.
@jonathanong this might help https://github.com/nodejs/node/pull/14330/files 🤷♂️
from compress.
I have it on 8.10.0 on windows
from compress.
@dominictobias can you please confirm that #60 (comment) can be used to reproduce the problem?
from compress.
Ah don't worry, I speed read on a number of issues and this is a general problem with npm cache and windows, rather than something koa specific 😳
from compress.
Related Issues (20)
- remove jest --forceExit
- tests: remove callbacks HOT 1
- Brotli used, even if not in Accept-Encoding header (v4.0.0) HOT 4
- Not using the correct encoding HOT 2
- If no Accept-Encoding header is sent, koa-compress may compress the response HOT 9
- Can this be used without koa? HOT 1
- koa-compress not compressing response body. HOT 1
- 4.x seems to be significantly slower (not related to brotli!) HOT 4
- Expand documentation HOT 12
- Brotli Defaults HOT 13
- "flush" as it is used in tests HOT 1
- Default Brotli compression level is too slow HOT 16
- Q: `options.defaultEncoding` default `idenity`, typo? HOT 1
- Error [ERR_HTTP2_HEADERS_SENT]: Cannot set headers after they are sent to the client HOT 1
- Content-Length Not Set HOT 2
- 5.1 did not set brotli default quality to 4 correctly HOT 1
- An in-range update of eslint-plugin-flowtype is breaking the build 🚨 HOT 7
- An in-range update of supertest is breaking the build 🚨 HOT 4
- Check that response hasn't been sent already HOT 2
- consider adding `response.originalLength` property HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compress.