Repository navigation
Description
[REQUIRED] Environment info
firebase-tools:
v14.9.0
Platform:
macOS , Ubuntu
[REQUIRED] Test case
Deploying a cloud function (v1) with firebase-tools v14.9.0 or v14.8.0 results in this error every time the function is called before it even reaches the code
uncaughtException: EROFS: read-only file system, open 'pglite-debug.log' Error: EROFS: read-only file system, open 'pglite-debug.log'
Uncaught exception
Error: EROFS: read-only file system, open 'pglite-debug.log'
Error: Process exited with code 16 at process.<anonymous> (/layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/invoker.js:96:22) at process.emit (node:events:536:35) at process.emit (node:domain:489:12) at process.exit (node:internal/process/per_thread:184:15) at sendCrashResponse (/layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/logger.js:49:9) at process.<anonymous> (/layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/invoker.js:85:44) at process.emit (node:events:536:35) at process.emit (node:domain:489:12) at process._fatalException (node:internal/process/execution:188:25)
We reproduced the issue on ~50 different cloud functions (all v1), database triggers, cron jobs, pubsub, ... all had the same behavior
We event tries to remove all code and only deploy a console.log in the function content and had the same behabior
The issue went away once we downgraded firebase-tools to v14.7.0 or lower
The issue also wasn't reproducible on cloud functions v2 (cloud run functions)
The error stacktrace doesn't help much but it seems to be caused by #8750 which added @electric-sql/pglite, which seems to cause some automatic file write on boot which is not allowed on cloud functions v1
[REQUIRED] Steps to reproduce
Deploy a cloud function v1 using firebase-tools v14.9.0 or v14.8.0
Try to run it
[REQUIRED] Expected behavior
The function to run normally
[REQUIRED] Actual behavior
The function crash with code 16 and a EROFS exception
Activity
aalej commentedon Jul 10, 2025
Hey @AlexBeauchemin, sorry to hear you encountered this issue and thanks for reporting this. I've been trying to reproduce this, but so far I haven't been able to encounter the same behavior. Deployed v1 https, Firestore triggers, and a scheduled function but no errors were raised when they were running. Here’s the code I deployed along with the logs from each function.
I’m not sure if I may be missing something here to replicate the issue, if I am please let me know. Also, any chance you could share code snippets of your functions or an MCVE to help us reproduce this?
Let me also check this with someone from our engineering team. They might have a better idea on why/how that
pglite-debug.logfile is being added/opened in your functions.AlexBeauchemin commentedon Jul 10, 2025
@aalej thanks for the prompt reply
That is indeed interesting, could it be because I have
"firebase-tools": "^14.9.0",in thedependenciessection of my package.json ?Unfortunately I can't share the current code but I'll try to toy with it a little more and try to get more info on what is causing it and see if I can provide a reproducible scenario, and I'll close if I can't
aalej commentedon Jul 10, 2025
It does look like this is causing the issue. Just to verify, when you mentioned
The issue went away once we downgraded firebase-tools to v14.7.0 or lowerdid you mean downgrading thefirebase-toolsin the dependencies or downgrading the version offirebase-toolsyou used for deploying?joehan commentedon Jul 10, 2025
HI @AlexBeauchemin , really sorry for the inconvenience here, this one was on me. In 14.8.0, I added a top level call to
fs.createWriteStream('pglite-debug.log')while adding a feature for Firebase Data Connect. I didn't think to test this out on Cloud Functions (since it was for a different product), but that is definitely the problem here. I've got a PR incoming to fix this and will run a patch release later today to get it out.AlexBeauchemin commentedon Jul 10, 2025
@aalej I downgraded in both but the issue seems to be with the one used in package.json, not the one used to deploy
@joehan That make total sense, as I removed the dependency from our package.json file, it fixed the issue with 14.9.0
But there's a use case for having the lib here. In our case we have a cloud function that do a auth backup as a cron job (using
tools.auth.export()fromfirebase-tools)Thanks for looking into the issue and having a quick fix 👍 👌