question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Comments:36 (20 by maintainers)

github_iconTop GitHub Comments

1reaction
stydavcommented, May 25, 2020

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: true

the 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

0reactions
kingsleyzissoucommented, Mar 25, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mutations - Apollo GraphQL Docs
Apollo Android handles GraphQL mutations. Mutations are similar to queries in syntax, the only difference being that you use the keyword mutation instead...
Read more >
Mutations fail using aws-appsync with @apollo/react-hooks ...
This has a dependency on apollo-client 2.6.3, ... but then when posting a mutation, it got enqueued in redux-offline but never processed.
Read more >
Offline-First Approach for Mobile Apps: React Native and ...
Apollo Client is the true star in this project. It can make queries and mutations while maintaining a local store, cache queries, and...
Read more >
How to manage file uploads in GraphQL mutations using ...
Option 2: Seperate Upload Requests​​ Run a seperate server (or API) for uploading files. Upload the file in the first request, and then...
Read more >
Exploring Apollo GraphQL for Android - Real-world examples
This resembles the POST request for REST API's. But in GraphQL world it's called Mutation, using which we can update the data on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found