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
error using Next with compression package #3778
Comments
I've faced the same issue. My solution was to remove compression from Express and rely on a reverse proxy (i.e. Nginx) to do compression. This is actually the best practice because gzipping is a CPU-intensive operation which Node isn't really suitable for. Nginx is much better at this. Alternatively you could use Cloudflare or a similar CDN and rely on their optimizations (e.g. caching your static resources so Node will only have to serve them once). |
While @ghengeveld's point is valid. This bug is only present (for me at least) in dev mode. I was personally able to prevent this error by only running compression when app.prepare().then(() => {
const server = express();
if (!dev) {
server.use(compression());
}
} |
Facing the same weird issue (error appearing exclusively when using Chrome Dev Tools). @eli0shin's fix works for me too. |
I think this was solves when we introduced |
Expected Behavior
I'm facing a really werid error in express that I have no idea what the reason is. I'm using
compression
package with a custom serverCurrent Behavior
It works with no errors until I open dev tools (only in chrome)
Steps to Reproduce (for bugs)
custom-server-express
foldercompression
package and use it as a middlewareContext
Your Environment
The text was updated successfully, but these errors were encountered: