I am upgrading my app from Phoenix 1.6 to 1.7 and I have this issue that I can not figure it out:
== Compilation error in file lib/restaurants/router.ex ==
** (ArgumentError) dynamic segment "/:channel_id_filter/graphql" not allowed when forwarding. Use a static path instead
This is the snippet of the code used:
scope "/:channel_id_filter/graphql" do
pipe_through(:graphql)
forward("/", AbsintheCorsBugsnagPlug,
schema: Restaurants.Api.Schema,
json_codec: Jason,
json_decoder: Jason
)
end
My plug wraps the absinthe plug in rescue to be able to report crashes to Bugsnag:
def call(%Plug.Conn{body_params: body_params} = conn, opts) do
AbsinthePlug.call(conn, opts)
rescue
exception ->
Bugsnag.report(
exception,
severity: "error",
stacktrace: __STACKTRACE__,
metadata: %{
query: body_params
}
)
reraise(exception, __STACKTRACE__)
end
I need all the resources that have a string in front and then graphql to be forwarded to Absinthe graphql. I can not change the path since it’s used all over in the UI.
Is there a way to make this path work in Phoenix 1.7?