firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

fix(functions,emulators): loadTriggers() with top level await

Open muryoh opened this issue 8 months ago • 2 comments

Description

Context: ESM functions with firestore triggers The expected behavior of loadTriggers() is to try and require() the function entrypoint, falling back to dynamic import() when node raises a ERR_REQUIRE_ESM error. But node may also raise an ERR_REQUIRE_ASYNC_MODULE error when the module has top level awaits

This commit simply makes it so ERR_REQUIRE_ASYNC_MODULE also falls back to import()

Scenarios Tested

Tested on our (private) repo

Let me know if tests need to be added/updated :)

muryoh avatar Apr 01 '25 12:04 muryoh