WHOA... change of execution order... router_service.map_response is called PRIOR to the subgraph execution #1252
-
I started working with 0.9.4 and found that the router_service.map_response is called PRIOR to the subgraph execution... this is NOT GOOD... the map_response should be called after the downstream services have executed because the downstream services may be sending things back (headers) that the FINAL response needs to send back to the caller how to get around this??? I need the subgraphs to execute first I am using map_response to track overall response times and if you run it prior to subgraph execution then it doesn't work at all |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 9 replies
-
ping o0Ignition0o |
Beta Was this translation helpful? Give feedback.
-
Hey! FYI The team is mostly online during CET working hours. I've updated the plugin example I use to test the APIs to gather and display subgraph response times. It's worth noting that given the Body of the response is now a stream, we need to wait until we receive the first response before we have a look at the context. Please let me know if it helps! |
Beta Was this translation helpful? Give feedback.
-
Thanks for the example... The execution order has changed, why???? I don't believe it's the right thing... Your documentation chart on execution order doesn't reflect what is going on now.... https://www.apollographql.com/docs/router/customizations/overview/ IMHO I think there is a flaw in the changes that have been introduced into the infrastructure because now there is "magic" that people have to implement if they want the execution order to happen as they think it would... I ended up writing 2 plugins, but if people write multiple plugins that are mapping the execution, and it's not happening in the order they expect, you are going to have to continually deal with support issues and complaints. It seems that at the level where you interpret the custom plugins for execution that you can layer them in so that the execution order can be retained??? |
Beta Was this translation helpful? Give feedback.
-
so i got access to the response after subgraph execution... using
HOW do i get access to the response.status and the response.headers_mut after the subgraph execution? I possibly may need to add response headers and i need access to the overall response status? QQ: there are 2 clones of the context.. is it actually copying the whole object twice or is it just a reference to the object? |
Beta Was this translation helpful? Give feedback.
Hey!
FYI The team is mostly online during CET working hours.
I've updated the plugin example I use to test the APIs to gather and display subgraph response times.
It's worth noting that given the Body of the response is now a stream, we need to wait until we receive the first response before we have a look at the context.
Please let me know if it helps!