Firebase-tools: Firestore Emulator times out when using merge option

Created on 15 May 2019  Â·  10Comments  Â·  Source: firebase/firebase-tools

[REQUIRED] Environment info

firebase-tools: 6.9.1

Platform: macOS

[REQUIRED] Test case

test('Should not time out but it does', async () => {
    const db = await setup();

    expect.assertions(1);

    await db
      .collection('tests')
      .doc('db78f802-1efb-4674-bbf9-3b97f4180240')
      .delete();

    await expect(
      db
        .collection('tests')
        .doc('db78f802-1efb-4674-bbf9-3b97f4180240')
        .set(
          {
            alpha: { '43280116-7275-11e9-a923-1681be663d3e': 'alpha' },
          },
          { merge: true }
        )
    ).toAllow();
  });

[REQUIRED] Steps to reproduce

- `firebase emulators:start --only firestore`
- `FIREBASE_FIRESTORE_EMULATOR_ADDRESS=127.0.0.1:8080 jest`

[REQUIRED] Expected behavior

It would allow to set object, given security rules are allowing it

[REQUIRED] Actual behavior

Timeout - Async callback was not invoked within the 50000ms timeout specified by jest.setTimeout.Error:

emulator-suite firestore bug

Most helpful comment

Duplicate of https://github.com/firebase/quickstart-nodejs/issues/66

The issue here is caused by the way we sanitize the emulator before publishing it. I finally have a solution for this and I'm hopeful we can get it out in a release or two.

I imagine it's not always possible (and I hate even suggesting it), but one workaround is to avoid hyphens in your map keys.

All 10 comments

Thanks for the report @Yuripetusko, sounds like a bug.

FYI your command could be expressed as just firebase emulators:exec --only firestore "jest", we automatically start the emulators, run your command with the correct env vars, and then stop them.

Works if i set merge: false or if I try to set simple value like alpha: true, but as soon as I set merge: true and try to set object then it times out

And it only times out if Document wasn't created previously. If I create Document first (merge: false) and then set it in another call but now with merge: true then it passes fine

Actually.. it's when I set key as UUID ??

SO this works:


test('Should not time out but it does', async () => {
    const db = await setup();

    expect.assertions(1);

    await expect(
      db
        .collection('tests')
        .doc('db78f802-1efb-4674-bbf9-3b97f4180240')
        .set(
          {
            alpha: { alpha: 'delta' },
          },
          { merge: true }
        )
    ).toAllow();
  });

But this times out

test('Should not time out but it does', async () => {
    const db = await setup();

    expect.assertions(1);

    await expect(
      db
        .collection('tests')
        .doc('db78f802-1efb-4674-bbf9-3b97f4180240')
        .set(
          {
            alpha: { '43280116-7275-11e9-a923-1681be663d3e': 'delta' },
          },
          { merge: true }
        )
    ).toAllow();
  });

Thanks for the repro, digging into what's going on inside. Seems like something subtle.

Duplicate of https://github.com/firebase/quickstart-nodejs/issues/66

The issue here is caused by the way we sanitize the emulator before publishing it. I finally have a solution for this and I'm hopeful we can get it out in a release or two.

I imagine it's not always possible (and I hate even suggesting it), but one workaround is to avoid hyphens in your map keys.

I have more timeout issues in emulator, this time I am not using hyphens in mpa keys, should I create a new issue or I can post it here?

Please file a new issue if you think it's a new bug, thanks!

On Wed, May 29, 2019, 11:31 AM Yuri notifications@github.com wrote:

I have more timeout issues in emulator, this time I am not using hyphens
in mpa keys, should I create a new issue or I can post it here?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-tools/issues/1293?email_source=notifications&email_token=ACATB2WTLYKPSBVQPAJYBYLPXZEQHA5CNFSM4HM6Q7BKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWOX4WY#issuecomment-496860763,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACATB2SL3I3BL7Z4OZYEOUTPXZEQHANCNFSM4HM6Q7BA
.

Closing this since #1380 has been merged and there are no additional reports.

Was this page helpful?
0 / 5 - 0 ratings