enqueued mutation related to apollo-upload-client
See original GitHub issue- Affected Package(s): offix-client
- Package version(s): 0.15.1
- Platform (e.g. Android/iOS): Android
- Platform Version: 8.0.0
- Node.js / npm versions: 12.14.1
when an image upload is triggered while offline, the operation gets enqueued. The mutation is like this:
mutation UploadMutation($file: Upload!){ uploadMutation(file: $file){ url } }
apollo-upload-client version is 13.0.0. Uploading while online works fine so no compatibility issues there.
the offline queue operation fails because offix sends the upload mutation in exactly the same format as apollo would send it without having the upload link from apollo-upload-client set up (results in a non-uploadable file).
So this file transformation piece that apollo upload client does gets lost somehow.
Is there a forseen way to deal with this kind of thing? Otherwise grateful for any recommandations or workarounds on how to use the current functionality to deal with this kind of issue.
Issue Analytics
- State:
- Created 3 years ago
- Comments:36 (20 by maintainers)

Top Related StackOverflow Question
file is not being transformed with offix boost as offix-client with manually initialized apollo-upload-link does, this can be seen when logging the file on the backend. Ill provide an example on the bottom.
tried the following with the same codebase: 1.) offix-client apollo-upload-link (ApolloLink) 2.) offix-client-boost with
fileUpload: truethe first transforms the file, upload works, the second does not, see the example for offix-boost it is the same result as if no upload link had been initialized, i.e. the file transformation does not occur
but even if this worked, the issue also related to the queue: the queued operation, when going back online, should go through this apollo link chain in order for the file transformation to occur
is this currently the case for the queued operations?
example for a) “raw” and b) transformed file
a) offix boost (which to my knowledge also uses apollo-upload-client as set in ‘packages\offix-client-boost\src\links\index.ts’ line 43):
<ActionController::Parameters {"uri"=>"file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540stydav%252Fteam_a/Camera/add77367-1311-46ea-90d1-b8070971114f.jpg", "name"=>"photo_1590415347823.jpg", "type"=>"image/jpg"} permitted: true>the file is initialized in the react native app as follows:
new ReactNativeFile({ uri: imageUri, name:photo_${+new Date()}.${fileType}, type:image/${fileType}, })as it can bee seen that the file is not being transformed
b) offix-client with manually initialized apollo-upload-link:
<ActionDispatch::Http::UploadedFile:0x000000000adbb758 @tempfile=#<Tempfile:C:/Users/---/AppData/Local/Temp/RackMultipart20200525-16892-7jv8fo.jpg>, @original_filename="photo_1590415712125.jpg", @content_type="image/jpg", @headers="content-disposition: form-data; name=\"1\"; filename=\"photo_1590415712125.jpg\"\r\nContent-Type: image/jpg\r\nContent-Length: 716017\r\n">as it can be seen the file is being transformed
Hi @stydav, we have made the decision to move away from the Apollo client and we have decided to deprecate our Offix packages and release our Datastore. I will be closing this issue, but if you have any questions, please feel free to let us know.
You can see the docs for the updated datastore here: https://offix.dev/docs/getting-started