Relay Absinthe page_info Error with New Connection

Hi All,

I have been trying to get Relay’s connections up and running, e.g.

defmodule Api.Gql.Schemas.Api.Types do
  use Absinthe.Schema.Notation
  use Absinthe.Relay.Schema.Notation, :modern

  import_types(Api.Gql.Groups.Types)  
  ... 

  connection node_type: :group                                                                                                                                                                                                               

But, I get the following error:

Invalid Schema Page_info :page_info is not defined in your schema.

I know the Connection type uses a page_info type but it cannot find it…

Also, I have nodes up and running, so I am part of the way there, just don’t understand how to get the rest of the way…

I have also tried putting the connection macro inside of the Groups.Types module (and many other things) without luck.

Hey there.

There’s a couple of things you’ll want to do.

  1. Almost always, you only need to import_types in your actual schema. This can lead to issues, and will produce a warning in 1.5

  2. Can you show your actual schema? If the page info type is missing this probably means you forgot to do use Absinthe.Relay.Schema, :modern.

2 Likes

You nailed it with both suggestions!

The schema itself is rather unwieldy, so we broke everything up into smaller files with multiple imports.

But that looks problematic now, vis a vis importing types. May have to do a rethink…

Thanks again - really appreciate your time : )