Open tanius opened 5 years ago
So it will be an issue that can be tracked down to differences in the JSON files served by Graphryder API,
I compared the working and broken JSON files. The files obtained at /users
and /tags
do not differ in JSON structure. The files obtained at /posts
and /comments
differ only in the order of the JSON object keys, which according to the standard is supposed to be insignificant (see). So that is unlikely to make any difference.
I also looked at the HTTP requests made when clicking on one of the "Conversation → Latest Posts" entries. What's happening is an XHR request such as https://graphryder1.edgeryders.eu/api/post/hydrate/61567
. When JSON is returned, the popup works. When an error message is returned, the popup will not work.
The error message observed (at the above example URL, actually), is this:
/var/www/clients/client7/web38/web/routes/post/post_getter.py", line 29, in get():
post = record['find'].properties
AttributeError: 'Node' object has no attribute 'properties'
So there we have it …
And it turns out that this bug is due to a a change in the class structure in the neo4j-driver
python package. Originally, version 1.0.0 was in use (see) but this caused import errors when encountering from neo4j import Record
. So I updated to version 1.6.3 (the 1.6.x series being the earliest version that fixes this error). And here, the class structure must be slightly different: instead of Node::properties
, the attribute is now named Node::_properties
.
After changing this in the location indicated above, the popups for Discourse topics (here called "posts") started to work. However, the same change has to be made throughout the software now, as clicking on comments, users etc. does not yet bring up a working popup.
Side note: a good technique to debug this turned out to be this:
Visit one of the failing requests in the browser, such as https://graphryder1.edgeryders.eu/api/post/hydrate/61567
.
Hover over one frame in the stacktrace and click the icon to the right to enable the interactive debugger (needs a PIN).
Use dump(…)
to explore the object structure of what we got as a result.
In Graphryder Dashboard, open a content preview popup by clicking on an entry in the "Conversation → Latest Posts" or "Conversation → Latest Comments" sections. For some instances of Graphryder API or some datasets inside these instances, all tabs these popups will be empty (Body, Content, Responses, Comments, Codes) and for others they will show the content as they are supposed to. When these tabs are empty, the "Original content on Edgeryder" link above them will also point to the wrong location (the Graphryder Dashboard rather than
edgeryders.eu/…)
and the content meta information like author and title above that will be messed up (such as "NaN undefined NaN:NaN").This is not an issue with Graphryder Dashboard, because when pointing an existing Graphryder Dashboard installation to a different Graphryder API installation by editing
config.js
, one can create or fix this issue.So it will be an issue that can be tracked down to differences in the JSON files served by Graphryder API, between one case where the content preview popups work and one case where they don't. And that probably will lead to a bug in one instance of Graphryder API, producing the corrupted JSON files. Notably, that instance (
graphryder1api.edgeryders.eu
) has just been installed from this repository, so the bug is still here in the latest code of this repo.