Skip to content
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

Fix bug where ESM module load fails on windows. #3692

Merged
merged 4 commits into from Aug 25, 2021
Merged

Conversation

taeold
Copy link
Contributor

@taeold taeold commented Aug 19, 2021

Patch allows Windows users to deploy Firebase Functions packaged as ES module.

We apply the same fix we made for Windows ES module support in the Functions Emulator (#3574) to the triggerParser script.

Fixes #3689

@taeold taeold requested review from mbleigh and joehan August 19, 2021 17:31
@google-cla google-cla bot added the cla: yes Manual indication that this has passed CLA. label Aug 19, 2021
@taeold taeold requested a review from colerogers August 23, 2021 18:20
Copy link
Contributor

@joehan joehan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One phrasing nit in CHANGELOG

CHANGELOG.md Outdated Show resolved Hide resolved
taeold and others added 2 commits August 25, 2021 12:05
@taeold taeold merged commit 54a3f85 into master Aug 25, 2021
@ghost
Copy link

ghost commented Aug 26, 2021

Is writing them as ESM explained in docs?

@taeold
Copy link
Contributor Author

taeold commented Aug 26, 2021

@web2033 Nothing yet for Firebase Functions, but here's an article for Google Cloud Functions https://medium.com/google-cloud/es-modules-in-cloud-functions-f5be1676c8b5.

@ZYinMD
Copy link

ZYinMD commented Aug 26, 2021

Do I need to add "@google-cloud/functions-framework": "^1.9.0" explicitly?

@fouchekeagan
Copy link

@web2033 I will write a Medium article for Firebase Functions on Node 14 with ESM Modules within the next week.

@ZYinMD
Copy link

ZYinMD commented Aug 31, 2021

@fouchekeagan When writing your a blog, you might want to see this: microsoft/vscode#131837. I'd like to see how you set up your per-folder vscode settings.

(Unless you don't use typescript to write your functions, then this is totally irrelevant. )

@ghost
Copy link

ghost commented Sep 2, 2021

E-O_KcpXoAIsGSE

This is the minimal 'Hello World' example I came up with (Node 16 and ESM)
https://github.com/web2033/hello-esm-firebase

If I remove @google-cloud/functions-framework it won't deploy.

@taeold
Copy link
Contributor Author

taeold commented Sep 2, 2021

@web2033 I was able to deploy my function packaged as an ES module without including the @google-cloud/functions-framework package.

Maybe GCF team is slowing rolling out new version of the buildpack that includes the latest version of the @google-cloud/functions-framework, and I got lucky to be included in the early release batch.

@ghost
Copy link

ghost commented Sep 2, 2021

Node 16?

@taeold
Copy link
Contributor Author

taeold commented Sep 2, 2021

@web2033 Oh interesting. Deploying Node 16 function fails for me as well. Node 14 works.

@ghost
Copy link

ghost commented Sep 3, 2021

Do we need an issue to track it? In which package?
cc @mbleigh

@taeold
Copy link
Contributor Author

taeold commented Sep 3, 2021

@web2033 The change needs to happen on Google Cloud Functions backend team. I've let them know - will ping this thread when the change is rolled out. If you prefer following an issue, feel free to open one in firebase-functions or open a public one is GCF.

https://issuetracker.google.com/issues?q=componentid:187195%20status:open#

devpeerapong pushed a commit to devpeerapong/firebase-tools that referenced this pull request Dec 14, 2021
Patch allows Windows users to deploy Firebase Functions packaged as ES module.

We apply the same fix we made for Windows ES module support in the Functions Emulator (firebase#3574) to the triggerParser script.

Fixes firebase#3689
@bkendall bkendall deleted the dl-cf3-esm-windows-fix2 branch March 18, 2022 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Manual indication that this has passed CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

firebase deploy --only functions = [ERR_UNSUPPORTED_ESM_URL_SCHEME]
4 participants