You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been experimenting with adding compression middleware to the new eleventy-dev-server. Mostly so I can see how tiny I am able to keep my project footprint while running it locally 😁. Here is what that looks like in my eleventy.config.js file:
This works most of the time without issues. But some times i get this error message:
[dev:*eleventy] [11ty] Uncaught exception: (more in DEBUG output)
[dev:*eleventy] [11ty] Cannot set headers after they are sent to the client (via Error)
[dev:*eleventy] [11ty]
[dev:*eleventy] [11ty] Original error stack trace: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
[dev:*eleventy] [11ty] at new NodeError (node:internal/errors:387:5)
[dev:*eleventy] [11ty] at ServerResponse.setHeader (node:_http_outgoing:603:11)
[dev:*eleventy] [11ty] at ServerResponse.resp.end (/Users/martin/Sites/my-project/node_modules/@11ty/eleventy-dev-server/server/wrapResponse.js:102:16)
[dev:*eleventy] [11ty] at ServerResponse.end (/Users/martin/Sites/my-project/node_modules/compression/index.js:107:21)
[dev:*eleventy] [11ty] at write (/Users/martin/Sites/my-project/node_modules/finalhandler/index.js:302:9)
[dev:*eleventy] [11ty] at AsyncResource.runInAsyncScope (node:async_hooks:203:9)
[dev:*eleventy] [11ty] at listener (/Users/martin/Sites/my-project/node_modules/on-finished/index.js:170:15)
[dev:*eleventy] [11ty] at onFinish (/Users/martin/Sites/my-project/node_modules/on-finished/index.js:101:5)
[dev:*eleventy] [11ty] at callback (/Users/martin/Sites/my-project/node_modules/ee-first/index.js:55:10)
[dev:*eleventy] [11ty] at IncomingMessage.onevent (/Users/martin/Sites/my-project/node_modules/ee-first/index.js:93:5)
I'm guessing this is because of the order of when stuff is executed. Maybe trying to run compression on something that does not exist yet. I am looking for help to understand the error and tips for a better way to configure the compression middleware.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been experimenting with adding
compressionmiddleware to the neweleventy-dev-server. Mostly so I can see how tiny I am able to keep my project footprint while running it locally 😁. Here is what that looks like in myeleventy.config.jsfile:(eleventy 2.0.0-canary.16)
This works most of the time without issues. But some times i get this error message:
I'm guessing this is because of the order of when stuff is executed. Maybe trying to run compression on something that does not exist yet. I am looking for help to understand the error and tips for a better way to configure the compression middleware.
Beta Was this translation helpful? Give feedback.
All reactions