apollo_upload_server-ruby icon indicating copy to clipboard operation
apollo_upload_server-ruby copied to clipboard

Can anyone please add example how to use this?

Open vimox-shah opened this issue 7 years ago • 10 comments

vimox-shah avatar Jun 06 '18 07:06 vimox-shah

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.

fuelen avatar Jun 06 '18 08:06 fuelen

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

vimox-shah avatar Jun 06 '18 08:06 vimox-shah

@vimox-shah read issue https://github.com/jetruby/apollo_upload_server-ruby/issues/10

fuelen avatar Jun 06 '18 08:06 fuelen

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

fuelen avatar Jun 07 '18 18:06 fuelen

@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

vimox-shah avatar Jun 07 '18 18:06 vimox-shah

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?

fuelen avatar Jun 07 '18 18:06 fuelen

@vimox-shah please check https://github.com/jetruby/apollo_upload_server-ruby/issues/10#issuecomment-406928478; might be helpful for you too 👍

djGrill avatar Jul 23 '18 03:07 djGrill

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.

karensg avatar Sep 18 '18 09:09 karensg

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?

danimataonrails avatar Dec 13 '19 15:12 danimataonrails

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.

darylf avatar Jan 29 '21 20:01 darylf