Skip to content

Subscriptions with ActionCable do not work with new Interpeter #2495

@javiercr

Description

@javiercr

First of all, thank you for all your work on this library!

As it was previously reported, it seems there are some issues with the new Interpreter and ActionCableSubscriptions. This has been reported in #2446, #2483, but those issues didn't provide a failing case.

To do so I've forked the evilmartians/chronicles-gql-martian-library project (that's part of the blog post), and added the minimum set of changes to make it fail: update the graphql gem and add the new interpreter.

Here are the instructions to reproduce the bug

git clone -b graphql-ruby-new-interpreter-bug https://github.com/javiercr/chronicles-gql-martian-library.git
cd chronicles-gql-martian-library
bundle install
rake db:create
rake db:seed
bin/rails s

Now you can log in with john.doe@example.com and add some items. You'll see this in the console:

[ActionCable] Broadcasting to graphql-subscription:30a00d17-d811-4b66-a7de-227f94b01b69: {:result=>{"data"=>nil, "errors"=>[{"message"=>"Cannot return null for non-nullable field Subscription.itemAdded"}]}, :more=>true}
GraphqlChannel transmitting {"result"=>{"data"=>nil, "errors"=>[{"message"=>"Cannot return null for non-nullable field Subscription.itemAdded"}]}, "more"=>true} (via streamed from graphql-subscription:30a00d17-d811-4b66-a7de-227f94b01b69)

As you can see, result.data is nil. It seems that the SubscriptionType field is not receiving any object.

Rolling back to the previous commit (without the new interpeter), everything works perfectly:

[ActionCable] Broadcasting to graphql-subscription:23148bba-f699-4eb5-ba08-06721424e274: {:result=>{"data"=>{"itemAdded"=>{"user"=>{"id"=>"2", "email"=>"jane.doe@example.com", "__typename"=>"User"}, "__typename"=>"Item", "id"=>"10", "title"=>"test", "imageUrl"=>"http://testestest.com", "description"=>"tawdawdawdddd"}}}, :more=>true}
GraphqlChannel transmitting {"result"=>{"data"=>{"itemAdded"=>{"user"=>{"id"=>"2", "email"=>"jane.doe@example.com", "__typename"=>"User"}, "__typename"=>"Item", "id"=>"10", "title"=>"test", "imageUrl"=>"http://testestest.com", "description"=>"tawdawdawdddd"}}}, "more"=>true} (via streamed from graphql-subscription:23148bba-f699-4eb5-ba08-06721424e274)

I hope this helps, as we're looking forward to using the new interpreter and ActionCable subscriptions.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions