You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.
Phoenix errors when a second forward is declared to the same Plug. This can be worked around by wrapping the GraphQL.Plug.Endpoint with configuration in a new module Plug.
Arguably this may be a bug in Phoenix, as this seems like a reasonable thing to do...
There are 2 workarounds:
The plug wrapper workaround (suggested by @chrismccord) which hides the identity of the underlying plug
# Hello World wrapperdefmoduleHelloWorlddoplugGraphQL.Plug.Endpoint,schema: {GraphQL.Schema.HelloWorld,:schema}end# Simple Blog wrapperdefmoduleSimpleBlogdoplugGraphQL.Plug.Endpoint,schema: {GraphQL.Schema.SimpleBlog,:schema}endforward"/hello",HelloWorldforward"/blog",SimpleBlog
This is the get/post workaround which avoids forward altogether, losing ability to handle other HTTP verbs.
# Hello World exampleget"/hello",GraphQL.Plug.Endpoint,schema: {GraphQL.Schema.HelloWorld,:schema}post"/hello",GraphQL.Plug.Endpoint,schema: {GraphQL.Schema.HelloWorld,:schema}# Simple Blog exampleget"/blog",GraphQL.Plug.Endpoint,schema: {GraphQL.Schema.SimpleBlog,:schema}post"/blog",GraphQL.Plug.Endpoint,schema: {GraphQL.Schema.SimpleBlog,:schema}
Phoenix errors when a second
forward
is declared to the same Plug. This can be worked around by wrapping theGraphQL.Plug.Endpoint
with configuration in a new module Plug.Gives this error:
Arguably this may be a bug in Phoenix, as this seems like a reasonable thing to do...
There are 2 workarounds:
The plug wrapper workaround (suggested by @chrismccord) which hides the identity of the underlying plug
This is the
get
/post
workaround which avoidsforward
altogether, losing ability to handle other HTTP verbs.The error is fired here and perhaps could account for differing configuration?
https://github.com/phoenixframework/phoenix/blob/master/lib/phoenix/router/route.ex#L170-L172
The text was updated successfully, but these errors were encountered: