Picolab / pico-engine

An implementation of the pico-engine hosted on node.js
http://picolabs.io/
MIT License
43 stars 8 forks source link

Developer UI displays SyntaxError: Unexpected token '<', "<html> <h"... is not valid JSON #661

Open b1conrad opened 1 month ago

b1conrad commented 1 month ago

After much time has passed, with just "Loading..." on the page.

May be related to issue 493.

b1conrad commented 1 month ago

From the pico-engine.log file we see that a query has started but not finished. It is a pico-engine-ui/box query.

I thought the pico engine had a timeout for long-running queries?

Instead, it is nginx that times out and returns HTML:

<html>
<head><title>504 Gateway Time-out</title></head>
<body>
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx/1.24.0</center>
</body>
</html>

But the developer UI (in React) is expecting a JSON response from this query, hence the unexpected token complaint.

The console log shows the entire query URL. For example:

GET https://plan.picolabs.io/c/cljt4sikq0001ojpra6zs4kw0/query/io.picolabs.pico-engine-ui/box 504 (Gateway Time-out)

and running that query directly in a browser shows (after some delay (the nginx timeout)) the rendered HTML for the 504 Gateway Time-out.

b1conrad commented 1 month ago

Never mind. While writing the above comment, I tried the failing query directly and it worked. Hm.