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

Error: An unexpected error has occurred. • TypeError: Cannot read property 'wanted' of undefined #1469

Closed
mazlano27 opened this issue Jul 4, 2019 · 26 comments
Assignees

Comments

@mazlano27
Copy link

mazlano27 commented Jul 4, 2019

firebase-tools: 7.0.2

Platform: macOS

Deploying a website to firebase hosting stopped working.

firebase deploy --only hosting

Hosting successful.

Hosting fails.

[2019-07-04T15:46:39.915Z] ----------------------------------------------------------------------
[2019-07-04T15:46:39.918Z] Command: /Users/Azlan_Mac/.nvm/versions/node/v12.3.1/bin/node /Users/Azlan_Mac/.nvm/versions/node/v12.3.1/bin/firebase deploy --only hosting --debug
[2019-07-04T15:46:39.918Z] CLI Version: 7.0.2
[2019-07-04T15:46:39.918Z] Platform: darwin
[2019-07-04T15:46:39.918Z] Node Version: v12.3.1
[2019-07-04T15:46:39.919Z] Time: Thu Jul 04 2019 23:46:39 GMT+0800 (Malaysia Time)
[2019-07-04T15:46:39.919Z] ----------------------------------------------------------------------

[2019-07-04T15:46:39.928Z] > 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"]
[2019-07-04T15:46:39.928Z] > authorizing via signed-in user
[2019-07-04T15:46:39.929Z] [iam] checking project mydaypwaapp for permissions ["firebase.projects.get","firebasehosting.sites.update"]
[2019-07-04T15:46:39.930Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/mydaypwaapp:testIamPermissions
permissions=[firebase.projects.get, firebasehosting.sites.update]
[2019-07-04T15:46:41.155Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 04 Jul 2019 15:46:41 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, server-timing=gfet4t7; dur=1100, alt-svc=quic=":443"; ma=2592000; v="46,43,39", accept-ranges=none, transfer-encoding=chunked
[2019-07-04T15:46:41.157Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects/mydaypwaapp

[2019-07-04T15:46:41.471Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 04 Jul 2019 15:46:41 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,43,39", accept-ranges=none, transfer-encoding=chunked
[2019-07-04T15:46:42.874Z] TypeError: Cannot read property 'wanted' of undefined
at /Users/Azlan_Mac/.nvm/versions/node/v12.3.1/lib/node_modules/firebase-tools/lib/checkFirebaseSDKVersion.js:37:51
at processTicksAndRejections (internal/process/task_queues.js:89:5)

Error: An unexpected error has occurred.

@google-oss-bot
Copy link
Contributor

This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

@mazlano27 mazlano27 changed the title Error: An unexpected error has occurred. Error: An unexpected error has occurred. • TypeError: Cannot read property 'wanted' of undefined Jul 4, 2019
@prescottprue
Copy link

prescottprue commented Jul 5, 2019

Also seeing this issue when trying to deploy cloud functions. I believe this is the line causing the issue

@mazlano27
Copy link
Author

@prescottpure After some guidance from firebase support - we identified that npm 6.10 was causing this issue for me. Downgrading to 6.9.2 fixed it for me. Maybe that’s the same for you?

@realgamessoftware
Copy link

Same happens to me when deploying functions: firebase deploy --only functions

firebase-tools: 7.0.2

@prescottprue
Copy link

prescottprue commented Jul 5, 2019

@mazlano27 that did the trick, thanks for posting! @brunovig you should give that a try (npm i -g npm@6.9.2)

@cabyambo
Copy link

cabyambo commented Jul 6, 2019

Life saver @mazlano27

@realgamessoftware
Copy link

@prescottprue works for me as well. Thanks.

@samtstern
Copy link
Contributor

Thanks all for identifying the problematic line and finding a workaround!

@bkendall
Copy link
Contributor

bkendall commented Jul 8, 2019

I'll take a look at this this week, I hope. Thanks

b/137017689

@jhuleatt
Copy link
Contributor

jhuleatt commented Jul 8, 2019

It looks like the output of npm outdated firebase-functions --json=true, called here, hasn't changed between 6.9.2 and 6.10.0

6.9.2 vs 6.10.0 npm comparison

@hpoit
Copy link

hpoit commented Jul 10, 2019

Well I guess I'm the lucky one: npm i -g npm@6.9.2 did not work for me.

@nikhilbhalwankar
Copy link

@mazlano27 that did the trick, thanks for posting! @brunovig you should give that a try (npm i -g npm@6.9.2)

Thanks. This worked for me too. Looks like npm version 6.10 has some issues due to which cloud functions can not be deployed.

@bkendall
Copy link
Contributor

This has been mitigated in 7.1.0.

@lvhellgren
Copy link

Getting this error for both functions and hosting deployments after upgrading to npm 6.10.1 and firebase-tools 7.2.2. So far no luck with rollbacks.

@Thkasis
Copy link

Thkasis commented Aug 21, 2019

rolled back to npm 6.9.2 and it's working. Firebase -V is also 6.8.0

@lvhellgren
Copy link

The fix for me was to install node/10.16.3. Also now using firebase 7.0.2.

@npomfret
Copy link

npomfret commented Oct 4, 2019

Can we reopen this, I'm getting the problem again with:

firebase --version
7.4.0

node --version
v10.15.3

npm --version
6.11.3

yarn --version
1.15.2

The error:

npm ERR! Cannot read property '0' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR!     ...2019-10-04T15_25_42_651Z-debug.log
[2019-10-04T15:25:42.753Z] TypeError: Cannot read property 'wanted' of undefined
    at ~/.nvm/versions/node/v10.15.3/lib/node_modules/firebase-tools/lib/checkFirebaseSDKVersion.js:38:51

[edit] Upgrading to node 10.16.3 (or 12) didn't work.

[edit] ... more problems:

npm install firebase-functions@latest firebase-admin@latest --save
npm ERR! Cannot read property '0' of undefined

@bkendall
Copy link
Contributor

bkendall commented Oct 4, 2019

@npomfret sorry you're having trouble. First, I see two errors there: one about property '0' and one about 'wanted'. That's suspicious to me and without more context it's hard to say which is the appropriate error.

Your logs indicate to me that you're running the firebase tool using npm (the npm ERR! strings indicate this). Do you have firebase-tools installed as a dependency of the project and are running firebase in an npm script?

Without more information, it's hard to say what's going on. I cannot replicate your issue, but it looks like the Cannot read property '0' of undefined is going to be your first thing to sort out.

@npomfret
Copy link

npomfret commented Oct 4, 2019

I've run:

npm install -g firebase-tools

If that's what you mean?

The command I'm running to redeploy my website is:

firebase deploy --debug --only hosting

@bkendall
Copy link
Contributor

bkendall commented Oct 4, 2019

@npomfret are you running firebase deploy directly or using npm run ___ to execute it? If that's the case, the firebase-tools version in the package.json file that's installed in that folder would be the one being run, which could be causing the issue.

However, it looks like the property '0' is blocking you too, and I've not seen that error before. It may be coming from the build/parse step of the deployment. If you could share your package.json and firebase.json, that may help narrow down the cause.

@npomfret
Copy link

npomfret commented Oct 4, 2019

I'm using the command exactly as described above: firebase deploy --debug --only hosting.

There is no package.json in this case, I'm just deploying hosting so there's only really firebase.json and a public dir with the static content in.

@npomfret
Copy link

npomfret commented Oct 4, 2019

...solved sort of. There are some firebase functions present. I deleted them and that allowed the hosting deployment to succeed. Ugh. I hate node.

@bkendall thanks for helping

@bkendall
Copy link
Contributor

bkendall commented Oct 4, 2019

@npomfret 👍 glad you figured it out!

@bdairy
Copy link

bdairy commented Feb 7, 2020

Guys this issue is still happening... on Hosting only no problem,, but if I added the functions to the firebase project I get the error as u see in the photo

So basically a firebase project that has both functions and hosting.. when running
firebase deploy --only hosting
I get the below error.

image

If I removed functions folder ,, it works like charm.... this thing drives me crazy..

@ashlynbaum
Copy link

I was having this issue too. Thanks @bdairy. Removing the functions folder worked for me too.

both firebase deploy and firebase deploy --only hosting worked after removing the /fuctions

@FlashFard
Copy link

I have an Issue too but this time it's Getting project...
Unexpected error:
undefined
Scratch engine ready.

I wanted to HTMLify this: https://scratch.mit.edu/projects/554343455/editor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests