compdemocracy / polis

:milky_way: Open Source AI for large scale open ended feedback
https://pol.is
GNU Affero General Public License v3.0
761 stars 175 forks source link

embedded polis: votes endpoint returning 500 when `xid` is present #1092

Closed RoboTeddy closed 3 years ago

RoboTeddy commented 3 years ago

This is the actual http request my browser was sending, with extraneous headers/etc removed:

curl 'https://pol.is/api/v3/votes' \
  -H 'accept: application/json, text/javascript, */*; q=0.01' \
  -H 'content-type: application/json; charset=UTF-8' \
  --data-raw '{"lang":"en","weight":0,"vote":-1,"tid":4,"pid":"mypid","conversation_id":"7s45mddsfz","agid":1,"xid":"testxidhere"}'

it results in a 500 status code with a response body of TypeError: User.createDummyUser is not a function<br> &nbsp; &nbsp;at /app/src/conversation.js:100:23.

RoboTeddy commented 3 years ago

Hmm does anyone know what version of the Polis server is deployed on pol.is? It might be out of date — git grep doesn't show the code that is referred to in the error:

image

And some related code did move around as recently as 14 days ago: https://github.com/compdemocracy/polis/pull/757

So, hopefully, fixing this might just require redeploying (and if redeploying doesn't fix it, it will at least reveal a new issue).

colinmegill commented 3 years ago

It's possible the error was introduced in that recent commit. cc @metasoarous

metasoarous commented 3 years ago

@RoboTeddy Thanks for bringing this to our attention.

I think you're right that this was the result of these changes not having been deployed yet. I've gone ahead and redeployed. Please let us know if this fixes the problem for you.

Thanks again!

RoboTeddy commented 3 years ago

Hi @metasoarous; thanks!

Just tried re-running the curl command, and I get the same http status code and response body as before.

Are you sure the deploy is complete? If it is complete then maybe there's some kind of js packaging/rewriting going on that leads to an apparent mismatch in line number/code between the deployed bundle and the git repository.

metasoarous commented 3 years ago

@RoboTeddy Thanks for trying again, and for taking the time to scrutinize the line number discrepancies.

Indeed, it looks like I forgot to actually rebuild the client assets before redeploying :facepalm: Please give it another shot and let me know how it goes.

Thanks again!

RoboTeddy commented 3 years ago

@metasoarous hi thanks for sticking with! I'm still seeing the same error so far. By the way, if you want to try seeing what's going on with a tighter feedback loop than waiting for me to respond, you're welcome to run the curl command from the original post and observe the output — I'm also happy to keep checking the thread though, so up to your preferences!

metasoarous commented 3 years ago

@RoboTeddy Thanks for the follow up.

It's a little obvious in retrospect, but this was a server issue, not client (and indeed the commits on #757 were to the server code, not client code). I've updated the server deployment, and your curl command is working now.

Thanks again!