-
Notifications
You must be signed in to change notification settings - Fork 1
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
A TypeError associated with attempting to read #baseLogData #477
Comments
I think we're gonna need @wheresrhys for this one because I don't understand JS proxy classes very well or what this code is doing. What I do know is that Reliability Kit makes use of private fields a bunch (in this case I think we have two options due to the incompatibility of private fields vs proxies (I'm gonna leave the issue open until Rhys chips in because he might have strong opinions here):
I don't want to go with option 2 as our use of private fields is pretty legitimate and I think there are probably other ways to solve request logging. These are the things we'd have to change to support proxies in the logger package alone (at a glance, there are probably more):
|
I guess the alternative for us is to write a "proxy" manually by wrapping the library. I think it should work @GeoffThorpeFT |
Thanks Rhys 🙂 does this mean you're happy if the resolution in Reliability Kit is that we document this in the n-logger migration guide? |
I guess leave it with us for now. If it turns out that wrapping is not workable then we may come back to you to discuss further. In the meantime documenting that logger is unproxyable would be a good addition 👍 |
Node.js version: v14.19.3
Impacted package(s): logger
Steps to reproduce
We have some code in biz-ops-api that creates a proxy logger so that the graphql library can call it to produce logs of the queries that the API Explorer runs
I have swapped
n-logger
forlogger
here: https://github.com/Financial-Times/biz-ops-api/blob/main/server/lib/logger.js#L43There is some code here that creates a proxy: https://github.com/Financial-Times/biz-ops-api/blob/main/server/lib/logger.js#L76-L102
Both the above appear to run without error. However ...
On execution of a graphql query the execution of the proxy/logger causes the following error:
Expected behaviour
I would have expected a normal log output that contained the graphql query. The existing logger would have produced something like this:
The text was updated successfully, but these errors were encountered: