Query against Absinthe GraphQL Server with HTTPoison results in 505

Somehow, I am hitting a wall with using Absinthe.


I spent a whole day roaming through all the docs, but feel a bit overwhelmed.
:question:Is there a high level overview that somehow shows how all the different parts/packages of absinthe work together and when they are needed?

What I want to achieve

I want to have two servers, with one server that provides the database and the other server with no database queries against it.

server A - database, stores posts
server B - servers frontend. Sends queries to create a post or to lists all posts.

Where I am at

For now I have a server A running that connects to a postgres database and
allows to create and read database entries via the graphiql interface.


If i run HTTPoison.get() against the Server, I end up with a 505.
I really don’t understand why.

If I open the same address in the browser, the correct query result is displayed.
However, the server logs print

function ServerTestWeb.Absinthe.Plug.init/1 is undefined (module ServerTestWeb.Absinthe.Plug is not available)

It is probably a misconfiguration somewhere, but I lost the overview of what I am doing here.

Not really knowing what the cause is, I do not want to put all my code in here and flood the post, but I will gladly post what you guys want to see.

Hi @larshei,

Fortunately the answer is pretty easy here, you simply have a bug in our router. If you had posted your router code we could show the right version but, I’ll try to guess at it here.

Notice the error message: ServerTestWeb.Absinthe.Plug.init/1. See how it has ServerTestWeb in front? This tells me you have

scope "/", ServerTestWeb do
  # stuff with Absinthe.Plug here

This prepends ServerTestWeb to the module names inside the scope. You should do

scope "/" do
  # stuff with Absinthe.Plug here.
1 Like

Impressively quick find, this was correct and fixes the missing Plug.init() error.

However, the 505 when trying to query through HTTPoison remains.
Chrome dev tools tell me HTTP1.1 is used on querying through the browser, what I think should be what Hackney in HTTPoison uses as well.

Do you have a guess on this as well by chance?

No idea about that one sorry, that is very strange.

The 505 was caused by an encoding error due to sending a -character instead of its %20-repesentation.