-
Notifications
You must be signed in to change notification settings - Fork 960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERR_REQUIRE_ASYNC_MODULE
when deploying with Node.js v22.12.0
#8054
Comments
Thanks for the detailed report, @gustavopch! I'm currently working on reproducing this, but so far I haven't encountered the issue when deploying functions. I created this test case using the information provided. Could you let me know I may be missing anything here? Also, which version of |
Thanks for pointing that out. I'm getting an error when settings
So instead I set it to Any chance you could share additional details about your project's setup? Such as if you're using TypeScript or JavaScript and the |
@aalej My My {
"functions": {
"runtime": "nodejs22",
"source": "."
}
} Another thing that may be relevant is that my import { register } from 'tsx/esm/api'
register()
export const { fn } = await import('./exports.js') I'm using |
Thanks @gustavopch for the additional info! I'm now able to reproduce the error. I think the error comes from when import { register } from 'tsx/esm/api'
register()
export const { fn } = await import('./exports.js') Specifically, with this line export const { fn } = await import('./exports.js') When trying to deploy with the line above, the error gets raised. I'll check this with our engineering team so they can take a look. I've also updated the test case. |
@gustavopch fwiw, you might want to create an issue in https://github.com/GoogleCloudPlatform/functions-framework-nodejs too. Functions Framework would probably fail in the exact same way the Firebase CLI is failing here. See https://github.com/GoogleCloudPlatform/functions-framework-nodejs/blob/f607b54c2474bcee56afef03a1e8c612ccf14480/src/loader.ts#L74 |
oh nvm - functions framework uses more granular ESM module checks and won't have this issue iiuc. |
[REQUIRED] Environment info
firebase-tools: 13.28.0
Platform: GitHub Actions • Ubuntu 24.04.1 LTS (list of included software) • Node.js v22.12.0
[REQUIRED] Test case
While I don't have an MCVE at the moment, I believe the cause may be this specific line, which seems to be the only
require()
call infirebase-functions
:https://github.com/firebase/firebase-functions/blob/9ed934d3dc4c2c257ac1968a65f6913c73ca779f/src/runtime/loader.ts#L49.
[REQUIRED] Steps to reproduce
Try to deploy anything to Firebase Functions using Node.js v22.12.0 with
"type": "module"
inpackage.json
. I was able to deploy just yesterday via GitHub Actions (it ran with Node.js v22.11.0). In fact, Node.js v22.12.0's changelog lists this "notable change":require(esm) is now enabled by default
, which seems related to the error shown in the logs below.[REQUIRED] Expected behavior
Should not crash.
[REQUIRED] Actual behavior
The text was updated successfully, but these errors were encountered: