Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can anyone please add example how to use this? #12

Open
vimox-shah opened this issue Jun 6, 2018 · 10 comments
Open

Can anyone please add example how to use this? #12

vimox-shah opened this issue Jun 6, 2018 · 10 comments

Comments

@vimox-shah
Copy link

No description provided.

@fuelen
Copy link
Collaborator

fuelen commented Jun 6, 2018

This gem allows you to receive files using graphql.

Add gem to your rails application. Use ApolloUploadServer::Upload as a type for your file fields.

Use https://github.com/jaydenseric/apollo-upload-client to send files to your rails application.

ApolloUploadServer makes transformations and inserts files to appropriate keys.

@vimox-shah
Copy link
Author

I am using ActiveStorage. for active storage will it work? @fuelen

@fuelen
Copy link
Collaborator

fuelen commented Jun 6, 2018

@vimox-shah read issue #10

@fuelen
Copy link
Collaborator

fuelen commented Jun 7, 2018

@vimox-shah let's continue our discussion here.
Show bundle exec rake middleware

@vimox-shah
Copy link
Author

vimox-shah commented Jun 7, 2018

@fuelen
use Rack::Cors
use Raven::Rack
use Rack::Sendfile
use ActionDispatch::Static
use ActionDispatch::Executor
use ActiveSupport::Cache::Strategy::LocalCache::Middleware
use Rack::Runtime
use ActionDispatch::RequestId
use RequestStore::Middleware
use ActionDispatch::RemoteIp
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use ActionDispatch::Reloader
use ActionDispatch::Callbacks
use ActiveRecord::Migration::CheckPending
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
use Warden::Manager
use ApolloUploadServer::Middleware
use Bullet::Rack

@fuelen
Copy link
Collaborator

fuelen commented Jun 7, 2018

It looks like middleware did not apply to your params.
You must have query, operationName and variables in your params keys after apply.
Could you dig into gem and check the result of this line?

@djGrill
Copy link

djGrill commented Jul 23, 2018

@vimox-shah please check #10 (comment); might be helpful for you too 👍

@karensg
Copy link

karensg commented Sep 18, 2018

I just published an article how to use this gem with Activestorage:
https://medium.com/@karensgrigorjancs/effortless-file-uploads-with-activestorage-apollo-and-react-7a50929c40ca

Maybe a good idea to add this article to the Readme, as it covers the full scope, incuding the frontend.

@danimataonrails
Copy link

I cannot create a required field of ApolloUploadServer::Upload type. If I use !ApolloUploadServer::Upload I get the following error:

GraphQL::Schema::InvalidTypeError - Argument input on Mutation.createContentDocument is invalid: argument "file" type must be a valid input type (Scalar or InputObject), not FalseClass (false)

Has anyone managed to do this?

@darylf
Copy link

darylf commented Jan 29, 2021

Is there any updated documentation on how to use this gem?

The only blog posts I found are either 2 years old or incomplete examples of how to use this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants