apollo_upload_server-ruby
apollo_upload_server-ruby copied to clipboard
Can anyone please add example how to use this?
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.
I am using ActiveStorage. for active storage will it work? @fuelen
@vimox-shah read issue https://github.com/jetruby/apollo_upload_server-ruby/issues/10
@vimox-shah let's continue our discussion here.
Show bundle exec rake middleware
@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
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?
@vimox-shah please check https://github.com/jetruby/apollo_upload_server-ruby/issues/10#issuecomment-406928478; might be helpful for you too 👍
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.
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?
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.