Please explain the cause of the problem

Error: Failed to publish your Function. Got error: Uncaught ReferenceError: __dirname is not defined
at functionsWorker-0.9861942296343507.js:21032:18

There is no access to files/directories in workers. Many of the features in Node.js aren’t available in workers

Possibly I was on the wrong track @Walshy?

Nah this is right.

__dirname is a Node.js API to access the current directory (Modules: CommonJS modules | Node.js v20.5.1 Documentation)

This may get implemented as part of the Node.js compatibility effort you linked to but I’m not 100% sure on that (it definitely should be in path once done but not sure if we’ll expose it in the module)

There’s also the ongoing discussion about standardizing APIs related to paths as part of WinterCG: import.meta path helpers proposal by GeoffreyBooth · Pull Request #54 · wintercg/proposal-common-minimum-api · GitHub

1 Like