Skip to content

uncaughtException: EROFS: read-only file system, open 'pglite-debug.log' #8821

Closed

Description

@AlexBeauchemin

[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

Image
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

  1. added
    api: dataconnect
    on Jul 10, 2025
  2. aalej commented on Jul 10, 2025

    @aalej
    Contributor

    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.log file is being added/opened in your functions.

  3. AlexBeauchemin commented on Jul 10, 2025

    @AlexBeauchemin
    Author

    @aalej thanks for the prompt reply
    That is indeed interesting, could it be because I have "firebase-tools": "^14.9.0", in the dependencies section 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

  4. aalej commented on Jul 10, 2025

    @aalej
    Contributor

    could it be because I have "firebase-tools": "^14.9.0", in the dependencies section of my package.json ?

    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 lower did you mean downgrading the firebase-tools in the dependencies or downgrading the version of firebase-tools you used for deploying?

  5. joehan commented on Jul 10, 2025

    @joehan
    Member

    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.

  6. AlexBeauchemin commented on Jul 10, 2025

    @AlexBeauchemin
    Author

    @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() from firebase-tools)

    Thanks for looking into the issue and having a quick fix 👍 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: dataconnectapi: functionstype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions