-
Notifications
You must be signed in to change notification settings - Fork 105
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
dir-list already sent with trailing slash #497
Comments
adding the trailing slash causes problem-o-s jesse@corbett[[fastify-static-bug]]$ node --watch thingy.js | pino-pretty &
[16:13:24.557] INFO (149519): Server listening at http://127.0.0.1:3000
jesse@corbett[[fastify-static-bug]]$ curl -s http://localhost:3000/node_modules/@fastify/ > outputshit.json && sleep 1 && echo -------prob-------- && cat outputshit.json | jq
[16:13:48.497] INFO (149519): incoming request
reqId: "req-1"
req: {
"method": "GET",
"url": "/node_modules/@fastify/",
"host": "localhost:3000",
"remoteAddress": "127.0.0.1",
"remotePort": 49692
}
[16:13:48.502] WARN (149519): Reply was already sent, did you forget to "return reply" in "/node_modules/@fastify/" (GET)?
reqId: "req-1"
err: {
"type": "FastifyError",
"message": "Reply was already sent, did you forget to \"return reply\" in \"/node_modules/@fastify/\" (GET)?",
"stack":
FastifyError: Reply was already sent, did you forget to "return reply" in "/node_modules/@fastify/" (GET)?
at Reply.send (/home/jesse/fastify-static-bug/node_modules/.pnpm/[email protected]/node_modules/fastify/lib/reply.js:132:26)
at pumpSendToReply (/home/jesse/fastify-static-bug/node_modules/.pnpm/@[email protected]/node_modules/@fastify/static/index.js:350:21)
"code": "FST_ERR_REP_ALREADY_SENT",
"name": "FastifyError",
"statusCode": 500
}
[16:13:48.503] INFO (149519): request completed
reqId: "req-1"
res: {
"statusCode": 200
}
responseTime: 5.25226900074631
-------prob--------
{
"dirs": [
"static"
],
"files": []
}
jesse@corbett[[fastify-static-bug]]$ curl -s http://localhost:3000/node_modules/@fastify > outputshit.json && sleep 1 && echo -------NO-prob-no-trailing-slash-------- && cat outputshit.json | jq
[16:14:07.158] INFO (149519): incoming request
reqId: "req-2"
req: {
"method": "GET",
"url": "/node_modules/@fastify",
"host": "localhost:3000",
"remoteAddress": "127.0.0.1",
"remotePort": 56780
}
[16:14:07.159] INFO (149519): request completed
reqId: "req-2"
res: {
"statusCode": 200
}
responseTime: 0.9850010005757213
-------NO-prob-no-trailing-slash--------
{
"dirs": [
"static"
],
"files": []
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
Fastify version
5.x.x
Plugin version
8.x.x
Node.js version
20
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
rhel8 and ms windows
Description
When using the default json list for directories and fastify static trailing slashes trigger a reply-already sent error internally.
repro: https://github.com/jessekrubin/fastify-static-reply-sent
Link to code that reproduces the bug
https://github.com/jessekrubin/fastify-static-reply-sent
Expected Behavior
not throw an error or document how I am supposed to configure this?
The text was updated successfully, but these errors were encountered: