Skip to content

v5 sendFile fails with NotFoundError #6450

@red5h4d0w

Description

@red5h4d0w

Environment information

Version: 5.1.0

Platform: Linux 6.14.0 (Arch) (was also reproduced by our users on multiple Linux distros

Node.js version: 22.14.0

Any other relevant information:

What steps will reproduce the bug?

Launching the appImage version of Karaoke Mugen, the sendFile method errors out with

NotFoundError: Not Found
    at createHttpError (/tmp/.mount_Karaokj5Gnrt/resources/app.asar/node_modules/send/index.js:861:12)
    at SendStream.error2 [as error] (/tmp/.mount_Karaokj5Gnrt/resources/app.asar/node_modules/send/index.js:168:31)
    at SendStream.pipe (/tmp/.mount_Karaokj5Gnrt/resources/app.asar/node_modules/send/index.js:468:14)
    at sendfile (/tmp/.mount_Karaokj5Gnrt/resources/app.asar/node_modules/express/lib/response.js:1000:8)
    at ServerResponse.sendFile (/tmp/.mount_Karaokj5Gnrt/resources/app.asar/node_modules/express/lib/response.js:409:3)
    at /tmp/.mount_Karaokj5Gnrt/resources/app.asar/src/components/frontend.ts:106:8
    at Layer.handleRequest (/tmp/.mount_Karaokj5Gnrt/resources/app.asar/node_modules/router/lib/layer.js:152:17)
    at next (/tmp/.mount_Karaokj5Gnrt/resources/app.asar/node_modules/router/lib/route.js:157:13)
    at Route.dispatch (/tmp/.mount_Karaokj5Gnrt/resources/app.asar/node_modules/router/lib/route.js:117:3)
    at handle (/tmp/.mount_Karaokj5Gnrt/resources/app.asar/node_modules/router/index.js:435:11)

The relevant call from our app that errors out is made by

app.get('/*splat', (_req, res) => {
			res.sendFile(resolve(state.resourcePath, 'kmfrontend/dist/index.html'));
		});

By placing a console.log before the res.sendFile, I was able to find that resolve(state.resourcePath, 'kmfrontend/dist/index.html') computes to '/tmp/.mount_Karaokj5Gnrt/resources/kmfrontend/dist/index.html' which is the valid location of the file.

What is weird about this error is that it only happens in the appImage package, all our other packaging methods are unaffected.

I bisected this error to come from the express 4 to 5 migration commit which is why I ask here even though there's a lot of moving parts involved.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions