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

React Native, iOS: "Can't find variable: Image" #1279

Closed
ghost opened this issue Oct 3, 2018 · 19 comments
Closed

React Native, iOS: "Can't find variable: Image" #1279

ghost opened this issue Oct 3, 2018 · 19 comments

Comments

@ghost
Copy link

ghost commented Oct 3, 2018

Unhandled JS Exception: Can't find variable: Image

I get this message when I run a transaction on the iOS Simulator offline:

const ok = await db.runTransaction(async (t) => {
    t.set(docRef, data);
    return true;
});

It retries the transaction around 3-5 times over around 2 minutes, then throws the Exception.

I am using the Xcode "Network Link Conditioner" to disable the network.

Related
#183

Environment

  • iOS Simulator
  • MacOS,
  • RN: 0.55.3
  • Firebase (from yarn.lock):
firebase@^5.5.2:
  resolved "https://registry.yarnpkg.com/firebase/-/firebase-5.5.2.tgz#05fa180c058941dcbfc248882e829f2945aa0568"
    "@firebase/app" "0.3.4"
    "@firebase/auth" "0.7.7"
    "@firebase/database" "0.3.6"
    "@firebase/firestore" "0.8.2"
    "@firebase/functions" "0.3.1"
    "@firebase/messaging" "0.3.6"
    "@firebase/polyfill" "0.3.3"
    "@firebase/storage" "0.2.3"
@google-oss-bot
Copy link
Contributor

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@mikelehen
Copy link
Contributor

Ahh, interesting! runTransaction hits a different mechanism for sending network requests, so I guess that's why you are hitting this even though #183 was fixed.

It's worth noting that transactions do not work offline. They are expected to fail, though not via a "Unhandled JS Exception". :-) So This sounds like a bug, but you may want to revisit using transactions if you want that code to work while offline.

@mikelehen
Copy link
Contributor

Do you by chance get callstack with that error? Offhand I'm having trouble tracking down where it's coming from. Or if you can throw a project on github that reproduces the problem, that would help.

@ghost
Copy link
Author

ghost commented Oct 7, 2018

The Exception also throws when not using runTransaction.

It's worth noting that transactions do not work offline

That is the reason I am using runTransaction - I want to get a fail message in response.

Because there are no timeouts or cancellations for Promises, the normal await docRef.set(data) does not resolve when offline.

The runTransaction API gives a failed Promise after a certain amount of time.

I also want to avoid using the local cache, which the Firestore APIs seem to use unpredictably even when its turned off via settings.

It would be good to have a {source: "server"} option for writes and onSnapshot (it exists for reads).

The react-native-firebase library also has critical bugs.

Do you think Im better off just using the HTTP API directly?

I could not get a proper stack trace from React Native. This is from Chrome, Im not sure if there is a better way?

image

@mikelehen
Copy link
Contributor

Hrm, yeah, if you don't want caching or offline support, then the REST API may be a better option for you. Though I don't think it supports realtime listens (as onSnapshot() provides), so if you're using that, it may not be a perfect fit. :-/

@fredrivett
Copy link

I'm getting a similar issue, first bug report came in on Oct 17th 2018.

I'm not trying to access any images in Firebase which is what's confusing me about this error. Using the Firebase npm package (https://www.npmjs.com/package/firebase) to access our Firestore DB.

Sentry error report:
screenshot_2018-11-14_at_13_53_44

@Danelund
Copy link

Danelund commented Dec 4, 2018

@fredrivett did you resolve? I'm seeing the same thing

@fredrivett
Copy link

@Danelund no that error still persists for me. We're now actually looking to move away from Firebase to AWS, so haven't investigated much further. Are you on the latest version of the firebase-js-sdk? That's the next port of call I'm going to check, upgrade that and check back in. If you end up upgrading I'd be interested to hear if that fixes the issue.

@Danelund
Copy link

Danelund commented Dec 7, 2018

@fredrivett just upgraded to 5.7.0, seems to be working so far, but will have sentry report in from users :)

@fredrivett
Copy link

@Danelund thanks for looping back. Did this fix it for you? We haven't got round to upgrading yet (I know), but be intrigued if it cleared things up your end.

@Danelund
Copy link

@fredrivett nope - still getting it

@fredrivett
Copy link

fredrivett commented Jan 14, 2019

@Danelund Hmmph. Super strange issue this. Does seem to be coming from Firebase but clearly not affecting everyone using the SDK in React Native as otherwise this thread would be flooded.

@mikelehen
Copy link
Contributor

Sorry for the delays. I poked at this, and I have a hunch that the issue we're hitting is this new Image() call in webchannel (one of our dependencies). I've reached out to a dev on the team to see if we can get this resolved.

@fredrivett
Copy link

No worries @mikelehen. Appreciate you taking a look.

@mikelehen
Copy link
Contributor

Internal tracking issue: b/123242479

@Huzaifaak
Copy link

I am getting this issue with "firebase": "^5.7.3". Maybe you can track this issue with this screenshot:
screenshot_20190128-193924

@wilhuff
Copy link
Contributor

wilhuff commented Mar 5, 2019

@mikelehen FYI, the required webchannel fix has made it out to public webchannel.

@mikelehen
Copy link
Contributor

@wilhuff Thanks. I just checked and we picked up this change in 4983420 so the issue should actually be resolved in the latest release.

Please holler if anybody is still running into this.

@cawfree
Copy link

cawfree commented Jul 3, 2019

Simple workaround:

console.error = console.log;

@firebase firebase locked and limited conversation to collaborators Oct 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants