A
Alokai2y ago
akie

About request log from middleware to magento

hi everyone vsf I hope this message finds you well. I am reaching out today to ask for some guidance regarding a challenge I'm facing. Specifically, I need to inspect the requests (including headers) sent from Nuxt(is middleware) to Magento, and I'm not quite sure about the best way to accomplish this. I've attempted to log requests in plugins and middleware. While this did give me some request records, it seems that those are only requests made between the browser and the middleware, which isn't seem exactly what I need. I also tried to intercept requests after creating an Axios interceptors.request after const client = axios.create(config.axios) However, this didn't provide me with any different results. I noticed that @vue-storefront/magento-api imports Apollo, but after checking the corresponding config files in the project, I still didn't find the information I was looking for. My goal is to obtain the actual requests made to the Magento endpoint, such as https://localhost:3001/graphql?query=query+getStoresAndCurrencies%7BavailableStores%7Bstore_code+__typename%7Dcurrency%7Bavailable_currency_codes+__typename%7D%7D&operationName=getStoresAndCurrencies&variables=%7B%7D and inspect the associated headers. Could you please provide some guidance on how to achieve this? Any help would be greatly appreciated. Thank you for your time and consideration. Best regards, acacius
5 Replies
skirianov
skirianov2y ago
Hey @Acacius have you tried using HTTPToolkit? We generally recommend devs to use it, so that you can intercept requests from middelware to the platform. Let me know if that helps
akie
akieOP2y ago
thank you @skirianov , Firstly, I would like to thank you for your swift response and suggestion regarding my previous inquiry. I've tried using HTTPToolkit as per your recommendation, however, it appears this tool primarily captures requests from the browser to Nuxt, which isn't exactly what I'm looking for. Of course it's a very good way to view hearthandsvsf I am seeking to inspect the outbound requests from the middleware (the post-request portion), with the ultimate goal of obtaining the logs of the requests received by the backend at the time they are made. This will allow me to accurately modify the code in this portion to fit the needs of my project. Could you please provide any guidance or point me in the right direction as to how I can accomplish this? Your expertise and insights would be highly appreciated. Thank you for your time and consideration.💖
skirianov
skirianov2y ago
Hi @Acacius yes, we use HTTPToolkit for the middleware -> platform communication too. When you start HTTPToolkit it allows you to intercept calls from a particular terminal or port (I guess) so you need to select the terminal where middleware runs. In this case, I would recommend instead of running Nuxt and Middleware from a single command, run them separately in different terminals.
akie
akieOP2y ago
Thank you very much for your patience to answer, I wish you a happy life hearthandsvsf
skirianov
skirianov2y ago
No worries, thank you too ❤️ Let me know if you need anything else
Want results from more Discord servers?
Add your server