clockwork icon indicating copy to clipboard operation
clockwork copied to clipboard

Error loading request metadata while using Docker with Alpine Linux, PHP, and NGINX and Chrome Extension

Open dragoste17 opened this issue 6 years ago • 4 comments

I have created a docker container with alpine linux and installed PHP and Nginx. The clockwork package is installed and enabled. I am sure it's working as it is creating JSON files in the storage/clockwork.

I am trying to view the profiler in the browser but that seems to be giving this error: Error loading request metadata. Server returned an invalid JSON.. The frontend is built on vue and served separately.

Please let me know how to get this to work. It works fine when I don't use a docker container as my server. Am I missing some dependencies? Screen Shot 2020-09-17 at 14 35 58

It works perfectly fine when I open the route for clockwork. Just doesn't work while using the chrome extension

dragoste17 avatar Sep 17 '20 05:09 dragoste17

Hey, please try following - with Clockwork extension open go to chrome://extensions in a new tab. Select the Clockwork extension and you should see "background page" link under "inspect views".

Clicking on this link will open a dev tools window for the Clockwork extension itself and you should see the metadata requests in the network tab. Let me know what you find out.

itsgoingd avatar Sep 17 '20 14:09 itsgoingd

Thank you for your reply. I understand the issue now! My frontend and backend servers are hosted on separate ports. I'm using VueJS in the frontend and devServer.proxy property to forward the requests to the backend.

The extension is making an XHR request to the port of the frontend server but appending the name of my application for some reason (obfuscated part in the screenshot). If it didn't do that the requests would be appropriately redirected to the backend. Alternatively, if it uses the port of the backend directly, that works fine too. Screen Shot 2020-09-18 at 8 55 49

FYI, all my other requests use the correct path: Screen Shot 2020-09-18 at 9 02 00

dragoste17 avatar Sep 18 '20 00:09 dragoste17

Oops, forgot to respond here. If your backend app is deployed in a subdirectory, that's where Clockwork will look for the data. If this is the case you should see an X-Clockwork-Path header on your api responses. You can unset this header to make Clockwork look for the metadata in the domain root.

Another way to use Clockwork with apis is to use the web UI. You can open http://your-api.dev/__clockwork and get access to requests from all client apps.

itsgoingd avatar Sep 25 '20 10:09 itsgoingd

Got it. Thank you so much!

dragoste17 avatar Sep 28 '20 01:09 dragoste17