uesteibar / neuron

A GraphQL client for Elixir
https://hex.pm/packages/neuron
Other
331 stars 35 forks source link

Config not working in Elixir Release #39

Closed coladarci closed 5 years ago

coladarci commented 5 years ago

Hi, I am having an extremely hard time pinning this problem down, so forgive me if I struggle to make this actionable. But here it goes -

I have a brand new phoenix install running on Elixir 1.9. I am using latest Neuron and have it working locally. I configure it like this:

    Neuron.Config.set(url: "http://my-api-server/gql")
    Neuron.Config.set(headers: [authorization: "Bearer my-token])

It works well locally.

I then make a release using the new mix release, and when I run the release, my api calls seem to be ignoring the Neuron.Config.set(url: "http://my-api-server/gql") and hitting / (which is my phoenix app, not api server).

I don't have any env vars; this is all hard-coded (for now), so it can't be a config issue that I can spot. I do know elixir 1.9 changed how run time config works, so perhaps this is a real breaking change for your library?

I'm happy to in anyway to pin this down, I'm just sort of out of ideas!

Thanks..

uesteibar commented 5 years ago

Hi @coladarci! Thanks for reporting this :)

I was not aware of this change on elixir 1.9, but I had a quick look and I don't see exactly how it would affect the use case, but I'm probably missing something. Where exactly are you executing that code example? That would help understanding the situation.

Could you provide a repository with a minimal example that reproduces this issue? We can use any public graphql api like https://swapi.graph.cool. I'm happy to take a look at that and try to figure out what's going on 😃

coladarci commented 5 years ago

Thanks, @uesteibar for the quick response, I put together a project for this and... it doesn't happen there.

bitmoji

I will dig in and eventually find out something super strange, I imagine. I'll close this when I get to the bottom of it and confirm it's just me being a dumb dumb.

Appreciate your response..

uesteibar commented 5 years ago

Mmm interesting that it doesn't happen in a brand new project, could you tell me in which file you're running this code? that could help on figuring out what's happening there :)

coladarci commented 5 years ago

In the same project I tried setting the config both in a context function and in the controller; both worked. In my project I have it happening inside a context function.

Just for an update, this has gotten even more strange. From my testing, it does work when I do a mix release, it's that when I run this inside Docker, it starts to fail.

Needless to say, I am losing my mind :) Since I can't make this happen in a test project, I'm going to close for now and I'll re-open if I discover anything interesting..

Appreciate it..

uesteibar commented 5 years ago

Wow, that it fails when running inside a docker container does sound very weird... if you somehow manage to build a project in which we can reproduce it I'll be glad to have a look :)

Thanks for the time put into reporting this! 😃

coladarci commented 5 years ago

I got to the bottom of it - it was cryptic and specific to us. the tl;dr is that the URL being used was invalid and it failed in absolutely strange ways. Sorry for the fire drill :)

uesteibar commented 5 years ago

@coladarci happy to hear you found the issue! Do you think there's something we could do in this library to make the error more obvious?

coladarci commented 5 years ago

Nope :)

On Fri, Aug 2, 2019 at 5:07 AM Unai Esteibar notifications@github.com wrote:

@coladarci https://github.com/coladarci happy to hear you found the issue! Do you think there's something we could do in this library to make the error more obvious?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/uesteibar/neuron/issues/39?email_source=notifications&email_token=AAHVFB2V2T3KLWH6VJVHA7LQCQPRFA5CNFSM4IIIPMCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3NRXZI#issuecomment-517676005, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHVFB3V6R62ZVX3D76GUCLQCQPRFANCNFSM4IIIPMCA .