Skip to content

Angular service worker breaks file upload on Safari #24853

Closed

Description

@aSegatto

I'm submitting a...


[ ] Regression 
[x] Bug report 
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

On safari (both mobile and desktop) uploading a file to firebase storage with ngsw enabled causes an error. Upload works correctly on the other browsers or with service worker disabled.

Minimal reproduction of the problem with instructions

We built a demo project in order to demonstrate the issue. You can find the source code at this url and the deployed application is availlable at this url. Basically we are uploading a text file containing timestamp to firebase storage:


   const content = 'This is my blob content ' + new Date();
   const blob = new Blob([content], {type: 'text/plain'});
    const metadata = {
      'contentType': blob.type
    };
    firebase.storage().ref('blob').put(blob, metadata)

the application is built using angular cli with built in service worker support. Ngsw config should not allow service worker to cache any of the firebase data and is correctly working on all browsers.


"dataGroups": [
    {
      "name": "firebase",
      "urls": [
        "https://firebasestorage.googleapis.com/**"
      ],
      "cacheConfig": {
        "timeout":"10s",
        "maxSize": 10,
        "maxAge": "1s",
        "strategy": "freshness"
      }
    }
  ]

the application correctly uploads the file on the other browsers , but on safari we get this error :

Multipart body does not contain 2 or 3 parts.

We also run into a similar error regarding multipart and offset when trying to upload an image.

Environment


Angular Cli version: 6.0.8
Angular Service Worker version: 6.0.7


Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [x] Safari (desktop) version 11.1
- [x] Safari (iOS) version 11.4.1
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: 8.11.3  
- Platform:  Mac 

Others:

Activity

  1. gkalpak commented on Jul 12, 2018

    @gkalpak
    Member

    Closing as a duplicate of #23244. It seems to be the same underlying issue.

  2. angular-automatic-lock-bot commented on Sep 14, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  3. locked and limited conversation to collaborators on Sep 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions