Code Monkey home page Code Monkey logo

neuron's Introduction

neuron

Build Status Hex Version

A GraphQL client for Elixir.

Index

Installation

def deps do
  [
    {:neuron, "~> 5.1.0"}
  ]
end

JSON library

Neuron defaults to using Jason for JSON encoding and decoding. To use Jason, add it to your deps:

{:jason, "~> 1.1"}

It is also possible to customize which JSON library that is used:

Neuron.Config.set(json_library: AnotherJSONLibrary)

Connection

Neuron defaults to using HTTP(S) protocol with HTTPoison for Connecting to GraphQL endpoint. You can however customize that behaviour, by providing custom library, which should implement Neuron.Connection behaviour:

defmodule MyConnection do
  @behaviour Neuron.Connection

  @impl Neuron.Connection
  def call(body, options) do
    IO.inspect("NEURON CALLED")
    Neuron.Connection.Http.call(body, options)
  end
end

Then set it up in config:

Neuron.Config.set(connection_module: MyConnection)

Usage

iex> Neuron.Config.set(url: "https://example.com/graph")

iex> Neuron.query("""
      {
        films {
          count
        }
      }
    """)

Response will be:

{:ok, %Neuron.Response{body: %{"data" => %{"films" => %{ "count": 123 }}}, status_code: 200, headers: []}}

You can also run mutations:

iex> Neuron.query("""
      mutation createUser($name: String!) {
        createUser(name: $name) {
          id
          name
        }
      }
    """,
    %{name: "uesteibar"}
    )

You can also set url and headers as shown below:

iex> Neuron.query("""
      mutation createUser($name: String!) {
        createUser(name: $name) {
          id
          name
        }
      }
    """,
    %{name: "uesteibar"},
    url: "https://example.com/graph",
    headers: [authorization: "Bearer <token>"]
    )

Overriding HTTP Timeout

HTTPoison default timeout is 5000ms, in case we need to handle longer timeout, using default Neuron.Connection module, we could set connection_opts which will be passed to HTTPoison. So to override timeout to 15000ms, we could do:

iex> Neuron.Config.set(url: "https://example.com/graph", connection_opts: [recv_timeout: 15_000])

iex> Neuron.query("""
      {
        films {
          count
        }
      }
    """)

We can also set the timeout for a single request by passing the connection_opts to Neuron.query/3 instead:

iex> Neuron.query("...", %{}, connection_opts: [recv_timeout: 15_000])

More extensive documentation can be found at https://hexdocs.pm/neuron.

Running locally

Clone the repository:

git clone [email protected]:uesteibar/neuron.git

Install dependencies:

cd neuron
mix deps.get

To run the tests:

mix test

Style guide

Code is formatted with mix format and mix credo should not show warnings.

To format the code and run static code analysis with credo

mix format
mix credo

Contributing

Pull requests are always welcome =)

The project uses standard-changelog to update the Changelog with each commit message and upgrade the package version. For that reason every contribution should have a title and body that follows the conventional commits standard conventions (e.g. feat(connection): Make it smarter than Jarvis).

To make this process easier, you can do the following:

Install commitizen and cz-conventional-changelog globally:

npm i -g commitizen cz-conventional-changelog

Save cz-conventional-changelog as default:

echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc

Instead of git commit, you can now run:

git cz

and follow the instructions to generate the commit message.

Copyright and License

Copyright (c) 2017 Unai Esteibar

This software is released under the Internet Systems Consortium License.

neuron's People

Contributors

bmoelk avatar calvin-kargo avatar craigcottingham avatar ekstrom avatar esse avatar hez avatar hypno2000 avatar jeredmasters avatar jgwmaxwell avatar joobi-kargo avatar juulsme avatar kh0r avatar kianmeng avatar naps62 avatar ninigi avatar parkerduckworth avatar reallinfo avatar sashman avatar svan-jansson avatar techgaun avatar terkiterje avatar uesteibar avatar zesarone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neuron's Issues

Converting underscored keys to mixed case keys in mutation arguments

tl;dr

It appears that when making a request with Neuron to a Rails GraphQL API, there is no conversion (or config options for it that I could find) to deal with how a key is translated. I want to send a snake-case key like my_special_key and have it submitted as mySpecialKey.

This is an issue with arguments being submitted in a mutation for example.

Is this possible or already available?

More detailed:

The API I'm talking to expects a key to be called "organizationId". It fails if I send a map like this:

%{organization_id: "my-id"}

The server isn't adapting to it and I haven't seen how to tell the Neuron client to do something different with it. I have to send:

%{organizationId: "my-id"}

I can deal with that for simple data, but I also have data that passes a large, deeply nested Elixir map. I'd have to convert all the keys before sending.

Is there a built-in way to deal with this? A parser option or something I didn't see?

Better docs

Docs are missing clear examples and don't cover some of the configuration cases.

Support subscriptions

It would be great to implement support for subscriptions using websockex. The usage could roughly be:

defmodule SubscriptionExample do
  use Neuron.Subscription

  @url "https://my.awesome.graphql/endpoint"
  @query """
  subscription {
    user {
      name
    }
  }
  """

  def start_link(state) do
    Neuron.Subscription.start_link(@url, @query, __MODULE__, state)
  end

  def handle_update(data, state) do
    IO.puts "Received Update - #{inspect data}"

    {:ok, state}
  end
end

Which would be very similar to how websockex works.

Update to latest version of httpoison

$ mix deps.update httpoision
Resolving Hex dependencies...

Failed to use "httpoison" (version 1.0.0) because
  apps/alchemist/mix.exs requires ~> 1.0
  apps/practice_cube/mix.exs requires ~> 1.0
  neuron (version 0.3.1) requires ~> 0.11

Support httpoison v.0.13

It appears the version is pretty strictly defined to 0.11.2. Please consider allowing some broader version support if possible.

Neuron not working with Github v4

I'm new to both GraphQL and Elixir, so I apologize if there's something obvious here that I'm missing.

I'm trying to use Neuron to talk to the Github v4 GraphQL API. Here's my code:

    url = "https://api.github.com/graphql"
    headers = [Authorization: "bearer <REDACTED>"]
    query = "{ viewer { login }}"
    Neuron.Config.set(url: url)
    Neuron.Config.set(headers: headers)
    resp = Neuron.query(query)
    IO.puts inspect resp

Here's the content of resp:

{:error, %Neuron.Response{body: %{"documentation_url" => "https://developer.github.com/v4", "message" => "Problems parsing JSON"}, headers: [{"Server", "GitHub.com"}, {"Date", "Wed, 22 Aug 2018 08:59:57 GMT"}, {"Content-Type", "application/json; charset=utf-8"}, {"Content-Length", "89"}, {"Status", "400 Bad Request"}, {"X-RateLimit-Limit", "5000"}, {"X-RateLimit-Remaining", "4999"}, {"X-RateLimit-Reset", "1534931646"}, {"Cache-Control", "no-cache"}, {"X-OAuth-Scopes", ""}, {"X-Accepted-OAuth-Scopes", "repo"}, {"X-OAuth-Client-Id", "REDACTED"}, {"X-GitHub-Media-Type", "github.v4; format=json"}, {"Access-Control-Expose-Headers", "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval"}, {"Access-Control-Allow-Origin", "*"}, {"Strict-Transport-Security", "max-age=31536000; includeSubdomains; preload"}, {"X-Frame-Options", "deny"}, {"X-Content-Type-Options", "nosniff"}, {"X-XSS-Protection", "1; mode=block"}, {"Referrer-Policy", "origin-when-cross-origin, strict-origin-when-cross-origin"}, {"Content-Security-Policy", "default-src 'none'"}, {"X-Runtime-rack", "0.027861"}, {"X-GitHub-Request-Id", "D4E5:5794:51208:CD5F3:5B7D260C"}], status_code: 400}}

Running the same query with HTTPoison directly succeeds:

    url = "https://api.github.com/graphql"
    headers = [Authorization: "bearer <REDACTED>"]
    query = "{ viewer { login }}"
    query_json = "{ \"query\": \"query #{query}\" }"
    resp = HTTPoison.post(url, query_json, headers)
    IO.puts inspect resp

and the response:

{:ok, %HTTPoison.Response{body: "{\"data\":{\"viewer\":{\"login\":\"davefp\"}}}", headers: [{"Server", "GitHub.com"}, {"Date", "Wed, 22 Aug 2018 09:05:20 GMT"}, {"Content-Type", "application/json; charset=utf-8"}, {"Content-Length", "38"}, {"Status", "200 OK"}, {"X-RateLimit-Limit", "5000"}, {"X-RateLimit-Remaining", "4997"}, {"X-RateLimit-Reset", "1534931646"}, {"Cache-Control", "no-cache"}, {"X-OAuth-Scopes", ""}, {"X-Accepted-OAuth-Scopes", "repo"}, {"X-OAuth-Client-Id", "REDACTED"}, {"X-GitHub-Media-Type", "github.v4; format=json"}, {"Access-Control-Expose-Headers", "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval"}, {"Access-Control-Allow-Origin", "*"}, {"Strict-Transport-Security", "max-age=31536000; includeSubdomains; preload"}, {"X-Frame-Options", "deny"}, {"X-Content-Type-Options", "nosniff"}, {"X-XSS-Protection", "1; mode=block"}, {"Referrer-Policy", "origin-when-cross-origin, strict-origin-when-cross-origin"}, {"Content-Security-Policy", "default-src 'none'"}, {"X-Runtime-rack", "0.040132"}, {"X-GitHub-Request-Id", "D4FC:5796:D5F35:1A40E9:5B7D2750"}], request_url: "https://api.github.com/graphql", status_code: 200}}

Any suggestions on how I can debug this would be appreciated. Thanks!

Add GitHub Action to test all supported Elixir versions

GitHub Actions support build matrices, so it should be trivial [1] to support multiple runs for all of the supported versions of Elixir, at least to the minor version.

I enumerated through all the versions known to asdf from 1.6 on up, and came up with:

  • 1.6.6-otp-19
  • 1.6.6-otp-20
  • 1.6.6-otp-21
  • 1.7.4-otp-19
  • 1.7.4-otp-20
  • 1.7.4-otp-21
  • 1.7.4-otp-22
  • 1.8.2-otp-20
  • 1.8.2-otp-21
  • 1.8.2-otp-22
  • 1.9.4-otp-20
  • 1.9.4-otp-21
  • 1.9.4-otp-22
  • 1.10.3-otp-21
  • 1.10.3-otp-22

[1] For varying values of "trivial".

HTTP adapters

Is there any posibility to change the http layer? so it can use another client?

Duplicated fragment registration

Hey, @uesteibar !

First and foremost, thanks for the awesome lib.
I've run into an issue with using multiple fragments in the same body.

Example:

query {
  aThing(id: "123546789") {
    aSubThing {
      ...fragment1
      ...fragment2
      aProperty {
        aSubProperty
      }
    }
    anotherSubThing {
      ...fragment1
      ...fragment2
      aProperty {
        aSubProperty
      }
    }
  }
}

fragment fragment1 on aType {
  aProperty
}

fragment fragment2 on anotherType {
  bProperty
}

This issue is that after registering these fragments and running the query, I receive this error message:

"message": [
        "There can be only one fragment named \"fragment1\".",
        "There can be only one fragment named \"fragment2\"."
 ]

It's clear from this error message that the fragments are likely being duplicated somehow in the Neuron.Store.

I dug into Neuron's internals to see what I could find, and threw in some print statements:

lib/neuron/fragment.ex

@doc false
  def insert_into_query(query_string) do
    stored_fragments = Store.get(:global, :fragments, []) ++ Store.get(:process, :fragments, [])
    |> IO.inspect(label: "stored_fragments")

    fragments_to_add =
      query_string
      |> find_in_query
      |> IO.inspect(label: "fragments_to_add after find_in_query")
      |> Enum.map(&List.keyfind(stored_fragments, &1, 0, &1))
      |> IO.inspect(label: "fragments_to_add after List.keyfind stored_fragments")

    fragments_to_add =
      fragments_to_add
      |> Enum.reject(&is_atom/1)
      |> IO.inspect(label: "fragments_to_add after Enum.reject")
      |> Enum.reduce(fragments_to_add, &load_missing_fragments(&1, stored_fragments, &2))
      |> IO.inspect(label: "fragments_to_add after Enum.reduce load_missing_fragments")

    missing_fragments = fragments_to_add |> Enum.filter(&is_atom/1) |> Enum.map(&Atom.to_string/1)

    if Enum.any?(missing_fragments),
      do: raise(Neuron.MissingFragmentsError, missing_fragments: missing_fragments)

    fragments_to_add
    |> Enum.map(&elem(&1, 1))
    |> Enum.map(&elem(&1, 0))
    |> Enum.reduce(query_string, &"#{&1} \n #{&2}")
  end

After compiling and re-running, this was the output:

stored_fragments: [
  fragment1: {"fragment fragment1 on aType { aProperty }", []},
  fragment2: {"fragment fragment2 on anotherType { bProperty }", []}
]

fragments_to_add after find_in_query: [: fragment2, : fragment1, : fragment1, : fragment2]

fragments_to_add after List.keyfind stored_fragments: [
  fragment2: {"fragment fragment2 on anotherType { bProperty }", []},
  fragment1: {"fragment fragment1 on aType { aProperty }", []},
  fragment1: {"fragment fragment1 on aType { aProperty }", []},
  fragment2: {"fragment fragment2 on anotherType { bProperty }", []}
]

fragments_to_add after Enum.reject: [
  fragment2: {"fragment fragment2 on anotherType { bProperty }", []},
  fragment1: {"fragment fragment1 on aType { aProperty }", []},
  fragment1: {"fragment fragment1 on aType { aProperty }", []},
  fragment2: {"fragment fragment2 on anotherType { bProperty }", []}
]

fragments_to_add after Enum.reduce load_missing_fragments: [
  fragment2: {"fragment fragment2 on anotherType { bProperty }", []},
  fragment1: {"fragment fragment1 on aType { aProperty }", []},
  fragment1: {"fragment fragment1 on aType { aProperty }", []},
  fragment2: {"fragment fragment2 on anotherType { bProperty }", []}
]

It appears that the duplication is taking place after the query string is passed to find_in_query/2.

This makes sense, considering its function definition contains a regex to find all ... fragments:

lib/neuron/fragment.ex

defp find_in_query(query_string) do
    Regex.scan(~r/(?<=\.\.\.)\w+(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, query_string)
    |> List.flatten()
    |> Enum.map(&String.to_atom/1)
end

The fix is a simple one: call Enum.uniq/1 after the call to Enum.map/1 to remove any duplicates! After I made this change, the problem was solved, and the query was executed correctly.

The amended function:

defp find_in_query(query_string) do
  Regex.scan(~r/(?<=\.\.\.)\w+(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, query_string)
  |> List.flatten()
  |> Enum.map(&String.to_atom/1)
  |> Enum.uniq
end

The output after making this change:

stored_fragments: [
  fragment1: {"fragment fragment1 on aType { aProperty }", []},
  fragment2: {"fragment fragment2 on anotherType { bProperty }", []}
]

fragments_to_add after find_in_query: [: fragment2, : fragment1]

fragments_to_add after List.keyfind stored_fragments: [
  fragment1: {"fragment fragment1 on aType { aProperty }", []},
  fragment2: {"fragment fragment2 on anotherType { bProperty }", []}
]

fragments_to_add after Enum.reject: [
  fragment1: {"fragment fragment1 on aType { aProperty }", []},
  fragment2: {"fragment fragment2 on anotherType { bProperty }", []}
]

fragments_to_add after Enum.reduce load_missing_fragments: [
  fragment1: {"fragment fragment1 on aType { aProperty }", []},
  fragment2: {"fragment fragment2 on anotherType { bProperty }", []}
]

InputTypes

Hi, does neuron support input types?

If so, could you please explain it in documentation?

Thanks,

Jamie

Incorrect typespec on Neuron.query/3

The typespec on Neuron.query/3 states a return value of Neuron.Response.t(), but dialyzer blows up on this. The correct return type should be something like {:ok, Neuron.Response.t()} | {:error, response :: term}

Documentation incorrect for basic authentication

Dependency versions:

  • hackney: 1.11.0
  • neuron: 0.9.1
  • httpoison: 1.3.1

When following the example for using basic authentication, I'm receiving an error message from Hackney:

** (ArgumentError) argument error
    :erlang.list_to_binary([basic_auth: {"user", "paassword"}])
    (hackney) /Users/jaredknipp/dev/my_app/deps/hackney/src/hackney_bstr.erl:27: :hackney_bstr.to_binary/1
    (hackney) /Users/jaredknipp/dev/my_app/deps/hackney/src/hackney_headers_new.erl:193: anonymous fn/3 in :hackney_headers_new.to_iolist/1
    (hackney) /Users/jaredknipp/dev/my_app/deps/hackney/src/hackney_headers_new.erl:148: :hackney_headers_new.do_fold/3
    (hackney) /Users/jaredknipp/dev/my_app/deps/hackney/src/hackney_headers_new.erl:184: :hackney_headers_new.to_iolist/1
    (hackney) /Users/jaredknipp/dev/my_app/deps/hackney/src/hackney_request.erl:95: :hackney_request.perform/2
    (hackney) /Users/jaredknipp/dev/my_app/deps/hackney/src/hackney.erl:358: :hackney.send_request/2
    (httpoison) lib/httpoison/base.ex:633: HTTPoison.Base.request/9
    (neuron) lib/neuron.ex:98: Neuron.run/2

I believe hackney options should be specified by as the options argument via connection_opts to HTTPoison, not as headers. For example, using this for auth does work as expected:

Neuron.Config.set(connection_opts: [hackney: [basic_auth: {"user", "password"}]])

Optionally, you can set the Authorization header using the headers config option as so:

encoded_credentials = Base.encode64("user:password")
Neuron.Config.set(headers: ["Authorization": "Basic #{encoded_credentials}"])

If this can be confirmed, I can submit a PR w/ the updates.

"(Neuron.MissingFragmentsError) Fragments on not found"

Here's my query string:

{
  nodes(ids: ["gid://shopify/Product/95039285", "gid://shopify/Product/859892931"]) {
    ...on Product {
      title
      description
      metafields (first: 10) {
        edges {
          node {
            key
            value
          }
       }
      }
    }
  }
}

And my code:

Neuron.Config.set(url: ENV.graphql_url())
Neuron.Config.set(headers: [
  "Content-Type": "application/graphql",
    "X-Shopify-Access-Token": ENV.pwd()
])

Neuron.query(query)

It errors with:

** (Neuron.MissingFragmentsError) Fragments on not found
    (neuron) lib/neuron/fragment.ex:58: Neuron.Fragment.insert_into_query/1
    (neuron) lib/neuron.ex:97: Neuron.query/3

Am I doing anything wrong?
Thank you!

Allow to set configuration globally or for current process

Would be great to be able to configure Neuron just for the current process, by doing:

Neuron.Config.set(:global, url: "https://example.com/graph")

#or

Neuron.Config.set(:process, url: "https://example.com/graph")

Current syntax (Neuron.Config.set(url: "https://example.com/graph")) should set to :global.

How to add timeout to Neuron

Hi, This is not a bug/actual issue, it just trying to help people to set HTTP timeout when using Neuron if needed.
HTTP timeout is handled by Neuron.Connection module, and default Neuron.Connection module used HTTPoison for handling HTTP connection. So to set HTTP timeout to 15 second in default Neuron configuration, we can pass conection options via connection_opts, and set HTTPoison recv_timeout to 15_000. e.g:

Neuron.Config.set(url: url)
Neuron.query(query, params, connection_opts: [recv_timeout: 15_000])

I use Neuron a lot, and i think it's great: easy and simple, it just a bit of shame it takes a lot of code digging just to find out how to override default timeout and maybe this would help others too.

Multiple graphs?

How would one consume multiple graphs using Neuron? From the docs, the usage of a single config seems to disallow that. Perhaps an additional arity could be added to the query function to take in a config, so that users can populate and pass in? Or some sort of named graph in the config? Please let me know if I'm missing something obvious! This seems like a very nice product at first glance.

setting header which contains hyphen "-"

Hello @uesteibar,

I am using neuron for graphql connectivity. It is working all fine, but when I want to set a header Ex-Ample-Subscription-Key with some value, it is not getting recognized. It will throw error if I don't put quotes, it will not be recognized, if I put double quotes.
Please help me, to pass the header with hyphen (-)

Thank You

Documentation error: Overriding HTTP Timeout

There is a simple error in the documentation regarding the example for overriding the default HTTP timeout of 5 seconds.

The code snippet:
Neuron.Config.set(url: "https://example.com/graph", connection_opts: [recv_timeout: 15_000])

should be:
Neuron.Config.set(url: "https://example.com/graph", connection_opts: [timeout: 15_000])

That is, the configuration option should be timeout, not recv_timeout.

Note the correct usage in the Neuron.Connection.HttpTest test "with custom connection options".

Proper support for variables

Right now you need to interpolate variables, which is not really cool.It would be nicer to have an API like

Neuron.query("...", %{ variable: :value })

this way it won't be a breaking change.

We can also take this chance to

Enum graphql data type.

Hello i want to ask can i use enum data type for query in neuron, the server that i connect expecting enum for it's input. And what is the alternative if i can't do this.

Thank you.

Logo for neuron

Hello!

I am a graphic designer. I like to contribute by designing a logo for open source software. Do you want me to design a logo for neuron? I would like to hear if you have an idea.

you can see many logo design examples on my github profile.
https://github.com/reallinfo

Mutations doc Examples

Hello,
First of all, thank you for the work.

I'm using this lib to debug some graphql endpoint, but I still missing documentation for mutation's, like examples and how to use input.

Support for subscriptions

Does neuron support GraphQL subscriptions running off an Absinthe based server?

I will have extensive use of these in my app.

Using Neuron in Absinthe testing

Hello!

Thank you for the awesome library. I very much enjoy its DSL. :)

Would it make sense, for this library, to support Absinthe GraphQL endpoint testing also? How? :)

Allow to register fragments to use later

Would be nice to be able to register fragments for later use, with some syntax like:

# To register globally
Neuron.register_fragment(:global, fragment_string)

# To register just for the current process
Neuron.register_fragment(:process, fragment_string)

so when later using a fragment in your queries, neuron will add them at the end of the query instead of you having to do it manually every time.

Also, this way we could check if the fragments you are using exist or not and throw an error before running the request.

Bug in returning a JSONParseError

Neuron.Connection.Http can return a JSONParseError (https://github.com/uesteibar/neuron/blob/master/lib/neuron/connection/http.ex#L73):

  defp handle_unparsable(response, error) do
    {
      :error,
      %JSONParseError{
        response: build_response(response),
        error: error
      }
    }
  end

According to the typespec for JSONParseError, response is supposed to be a Neuron.Response.t(), but build_response/1 returns a tuple (https://github.com/uesteibar/neuron/blob/master/lib/neuron/connection/http.ex#L62):

  defp build_response(response) do
    {
      :error,
      %Response{
        status_code: response.status_code,
        body: response.body,
        headers: response.headers
      }
    }
  end

Config not working in Elixir Release

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..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.