LoginSignup
0
0

More than 5 years have passed since last update.

iOS + Angular + PWA + Firebase storage の環境で画像をアップロードするとエラーになる

Posted at

表題の環境で、モバイルから写真をStorageにアップするとStorageから下記のエラーが返される。

Client uploaded to the wrong offset (262144 instead of 0)

これを解消するには、ngsw-worker.jsの、onFetch(event)に下記を追加する。

if (event.request.url.indexOf('firebasestorage.googleapis.com') !== -1) { return; }

つまり、こんな感じになる

        /**
         * The handler for fetch events.
         *
         * This is the transition point between the synchronous event handler and the
         * asynchronous execution that eventually resolves for respondWith() and waitUntil().
         */
        onFetch(event) {
          if (event.request.url.indexOf('firebasestorage.googleapis.com') !== -1) { return; }

これで、Storageにアップできるようになった。

0
0
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
0
0