firebase-admin-node icon indicating copy to clipboard operation
firebase-admin-node copied to clipboard

auth.user().onCreate() fails with node: ../deps/uv/src/unix/epoll.c:312: uv__io_poll: Assertion `loop->watchers != NULL' failed.

Open jannikhst opened this issue 2 years ago • 0 comments

  • Operating System version: Firebase CloudFunctions NodeJS (v1)
  • Firebase SDK version: "firebase-functions": "^4.1.1"
  • Firebase Product: auth
  • Node.js version: CloudFunctions v1
  • NPM version: Deployed via firebase cli

[REQUIRED] Step 3: Describe the problem

I use the functions.auth.user().onCreate() hook to automatically create a database entry when a new user registers. However, this hook sometimes fails with the following log: node: ../deps/uv/src/unix/epoll.c:312: uv__io_poll: Assertion loop->watchers != NULL' failed.`

Steps to reproduce:

Here is the google cloud log:

{
  "textPayload": "node: ../deps/uv/src/unix/epoll.c:312: uv__io_poll: Assertion `loop->watchers != NULL' failed.",
  "insertId": "653bb6a900030d36d8cf181a",
  "resource": {
    "type": "cloud_function",
    "labels": {
      "region": "us-central1",
      "project_id": "XXXXXXX",
      "function_name": "auth-onRegistered"
    }
  },
  "timestamp": "2023-10-27T13:10:01.199990Z",
  "labels": {
    "execution_id": "oxv3664a2uje",
    "instance_id": "0037d6d5d3a7dcb74ae305ac7f40db1ec80f2048dd7c521217f638a659a3eca90a6fedc99509a9e10073d7934b12ba2cee8da5050c465062e73cf2d98207d9a4bb1c"
  },
  "logName": "projects/XXXXXXX/logs/cloudfunctions.googleapis.com%2Fcloud-functions",
  "trace": "projects/XXXXXXX/traces/be85c3c2262f49dfc8dd2f0645bfe485",
  "receiveTimestamp": "2023-10-27T13:10:01.539668946Z"
}

Relevant Code:

This is my code:

export default functions.runWith({ memory: "256MB", minInstances: 1 }).auth.user().onCreate(async (user) => {
    await usersCollection.doc(user.uid).set({
        'registeredAt': FieldValue.serverTimestamp(),
        'profile': {
            'name': '',
            'image': null,
        }
    });
});

jannikhst avatar Nov 07 '23 12:11 jannikhst