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

firebase deploy --only functions = [ERR_UNSUPPORTED_ESM_URL_SCHEME] #3689

Closed
fouchekeagan opened this issue Aug 18, 2021 · 7 comments · Fixed by #3692
Closed

firebase deploy --only functions = [ERR_UNSUPPORTED_ESM_URL_SCHEME] #3689

fouchekeagan opened this issue Aug 18, 2021 · 7 comments · Fixed by #3692

Comments

@fouchekeagan
Copy link

fouchekeagan commented Aug 18, 2021

Environment info

firebase-tools: 9.16.5

Platform: Windows 10

Node: 14.17.3

NPM: 6.14.13

Package.json Dep:

Firebase: 8.9.1
@google-cloud/functions-framework: 1.9.0
firebase-functions: 3.15.4
Typescript: 4.3.5

Steps to reproduce

  1. Upgrade from node 10 to node 14 (update from commonJS to ESM).
  2. Attempt to deploy.

Expected behavior

The firebase functions to be deployed.

Actual behavior

Deploy fails while running pre-deploy script:
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

image

Additional info:
The same is shown if I specify a single function.
We had previously an issue with starting the emulators when initially updating to Node14 - this was resolved by #2994 / #3573 / #3574 (Thanks Daniel Lee!)
I can start the emulators and use the functions locally.

@google-oss-bot
Copy link
Contributor

This issue does not seem to follow the issue template. Make sure you provide all the required information.

@taeold
Copy link
Contributor

taeold commented Aug 19, 2021

@fouchekeagan Thanks for reporting the issue!

It looks like I forgot to apply the fix to module path issue on Windows (#3574) to the code path relevant to function deploys (

const mod = await dynamicImport(require.resolve(packageDir));
) 🤦‍♂️

@taeold
Copy link
Contributor

taeold commented Aug 19, 2021

I will try to get the fix merged soon so that the bug is fixed by next CLI release.

In the meantime, if anyone is willing to test out the fix (I don't have a Windows machine), I'd appreciate it:

> git clone https://github.com/firebase/firebase-tools.git
> cd firebase-tools
> git checkout origin/dl-cf3-esm-windows-fix2 
> npm i
> npm run build
> npm link # firebase cli should now point to locally built one
# cd to your functions project
> firebase deploy --only functions

@fouchekeagan
Copy link
Author

Thanks for the speedy response.
I tested the fix and was able to successfully deploy my functions!
Much appreciation for your help resovling this issue!

I'll leave this issue for you to close when it's merged?

@taeold
Copy link
Contributor

taeold commented Aug 24, 2021

@fouchekeagan Thanks a bunch for giving it a go. Yep that's the plan - I will close the ticket after our next CLI release.

taeold added a commit that referenced this issue Aug 25, 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
@PMLS3
Copy link

PMLS3 commented Nov 15, 2021

> npm run build

I will try to get the fix merged soon so that the bug is fixed by next CLI release.

In the meantime, if anyone is willing to test out the fix (I don't have a Windows machine), I'd appreciate it:

> git clone https://github.com/firebase/firebase-tools.git
> cd firebase-tools
> git checkout origin/dl-cf3-esm-windows-fix2 
> npm i
> npm run build
> npm link # firebase cli should now point to locally built one
# cd to your functions project
> firebase deploy --only functions

I have done this step by step, I am still getting: Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader

Any Assistance will be appreciated

@taeold
Copy link
Contributor

taeold commented Nov 15, 2021

@PMLS3 Can you try running the latest CLI version (the change has been released for few months):

npm i -g firebase-tools

devpeerapong pushed a commit to devpeerapong/firebase-tools that referenced this issue 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants