-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
concurrent map writes
in the module example
#458
Comments
WunderGraph commits fully to Open Source and we want to make sure that we can help you as fast as possible. |
Thank you for the detailed report. We'll take a look at the problem. We're currently quite busy so please expect that it might take some time. |
Can I do that? If not, what is the right way to do it? I have errors that I want to get back online but their status code is 401. func (m *MyModule) OnOriginResponse(response *http.Response, ctx core.RequestContext) *http.Response {
response.StatusCode = http.StatusOK
return nil
} Sometimes this code produces a panic
I can assume that |
HI @flymedllva, I could not reproduce your issue (please try latest) but you need to respect the following case. |
Thanks for the answer! |
You're right. I've updated docs. The current API is the first version since the announcement of the module system. The API is very low-level by purpose. We have waited for this feedback to improve it. Could you elaborate on your use case? Do I understand correctly, that you want to set a header on the final response? |
In OnOriginRequest, I want |
I was asking for your use cases. Do you want to set a header to the subgraph request OR do you want to add a header to final client response? And why do you want to override the response code? |
At the moment
In most cases I need to return a complete response, say when the errors are like this https://www.apollographql.com/docs/apollo-server/data/errors/#built-in-error-codes . |
Component(s)
router
What happened?
Description
When using the module from the example, sometimes the error
fatal error: concurrent map writes
occursThis happens if you set a debug
breakpoint
onctx.ResponseWriter().Header().Set("myHeader", ctx.GetString("myValue"))
, restart the router and send a requestSteps to Reproduce
Run router with module use 0.54.0 tag
Expected Result
No error
Actual Result
ctx.ResponseWriter().Header().Set("myHeader", ctx.GetString("myValue"))
->fatal error: concurrent map writes
Component version
135a54f
Environment information
Environment
OS: macOS 14.2.1 (23C71) M1
Package Manager: wgc downloaded from npm
Compiler(if manually compiled): go1.21.4
Router configuration
Router execution config
No response
Log output
Additional context
The text was updated successfully, but these errors were encountered: