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

ReferenceError: URL is not defined when downloading emulator in CircleCi with v8.16.0 & v8.16.1 #2817

Closed
martinklepsch opened this issue Nov 13, 2020 · 4 comments · Fixed by #2818
Assignees

Comments

@martinklepsch
Copy link

firebase-tools: 8.16.0 & 8.16.1

Platform: CircleCI circleci/node:8.14.0-stretch-browsers

Test case

The issue only occurs when the Emulator has not been downloaded yet.

$ npx firebase emulators:start --only firestore
i  emulators: Starting emulators: firestore
⚠  It appears you are running in a CI environment. You can avoid downloading the Firestore Emulator repeatedly by caching the /home/circleci/.cache/firebase/emulators directory.
i  firestore: downloading cloud-firestore-emulator-v1.11.9.jar...
i  emulators: Shutting down emulators.
i  firestore: Stopping Firestore Emulator
i  hub: Stopping emulator hub

Error: An unexpected error has occurred.

Steps to reproduce

$ rm -rf  /home/circleci/.cache/firebase/emulators
$ npx firebase emulators:start --only firestore

Expected behavior

The Emulator downloads and runs successfully.

Actual behavior

npx firebase emulators:start --only firestore --debug
[2020-11-13T16:42:29.120Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2020-11-13T16:42:29.121Z] > authorizing via FIREBASE_TOKEN environment variable
i  emulators: Starting emulators: firestore {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: firestore"}}
[2020-11-13T16:42:29.173Z] [hub] writing locator at /tmp/hub-icebreaker-devel.json
⚠  It appears you are running in a CI environment. You can avoid downloading the Firestore Emulator repeatedly by caching the /home/circleci/.cache/firebase/emulators directory.
i  firestore: downloading cloud-firestore-emulator-v1.11.9.jar... {"metadata":{"emulator":{"name":"firestore"},"message":"downloading cloud-firestore-emulator-v1.11.9.jar..."}}
i  emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}}
i  firestore: Stopping Firestore Emulator {"metadata":{"emulator":{"name":"firestore"},"message":"Stopping Firestore Emulator"}}
i  hub: Stopping emulator hub {"metadata":{"emulator":{"name":"hub"},"message":"Stopping emulator hub"}}
[2020-11-13T16:42:29.186Z] ReferenceError: URL is not defined
    at /home/circleci/icebreaker/functions/node_modules/firebase-tools/lib/emulator/download.js:69:19
    at Generator.next (<anonymous>)
    at /home/circleci/icebreaker/functions/node_modules/firebase-tools/lib/emulator/download.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/circleci/icebreaker/functions/node_modules/firebase-tools/lib/emulator/download.js:4:12)
    at downloadToTmp (/home/circleci/icebreaker/functions/node_modules/firebase-tools/lib/emulator/download.js:68:12)
    at /home/circleci/icebreaker/functions/node_modules/firebase-tools/lib/emulator/download.js:27:27
    at Generator.next (<anonymous>)
    at /home/circleci/icebreaker/functions/node_modules/firebase-tools/lib/emulator/download.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/circleci/icebreaker/functions/node_modules/firebase-tools/lib/emulator/download.js:4:12)
    at module.exports (/home/circleci/icebreaker/functions/node_modules/firebase-tools/lib/emulator/download.js:23:28)
    at Object.<anonymous> (/home/circleci/icebreaker/functions/node_modules/firebase-tools/lib/emulator/downloadableEmulators.js:304:23)
    at Generator.next (<anonymous>)
    at /home/circleci/icebreaker/functions/node_modules/firebase-tools/lib/emulator/downloadableEmulators.js:8:71
    at new Promise (<anonymous>)

Error: An unexpected error has occurred.

cc @nickpell

@bkendall bkendall self-assigned this Nov 13, 2020
@bkendall
Copy link
Contributor

🤦

So, turns out, the URL object is not a global thing in Node 8. looks like some patching is necessary in a few places. Thanks for the report.

@samtstern
Copy link
Contributor

@bkendall this is one of my least favorite kind of bugs, where TS made us less safe because the Node typings it provides can only represent a single Node version.

@martinklepsch
Copy link
Author

Thanks, that was quick! 🙌

@bkendall
Copy link
Contributor

We try 😄 we're queuing up a release right now to publish the fix. Thanks again!

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.

3 participants