LoginSignup
2
1

More than 3 years have passed since last update.

【Firebase】Unhandled promise rejection: ReferenceError: Can't find variable: atob と出た時の対処法

Last updated at Posted at 2020-06-26

はじめに

ReactNativeとFirebaseを組み合わせていた際に以下のようなエラーが出た

Unhandled promise rejection: ReferenceError: Can't find variable: atob

Firebase7.9.1以降のバージョンで多くの人が遭遇しているらしい

Firebaseのバージョンを7.9.0に戻すことでも解決できるとは思うが、以下の方法でも解決できた。

base-64モジュールをインストール

$ npm install base-64

問題のページの一番先頭に以下のコードを記入

index.js
if (!global.btoa) {
  global.btoa = encode;
}
if (!global.atob) {
  global.atob = decode;
}
import {decode, encode} from 'base-64';
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1