-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting error "expecting POST /_api/cursor" from Arangojs #800
Comments
Release 8.3.0 works, the problem started with release 8.4.0. |
ArangoDB 3.7 reached its End of Life in May 2022: https://arangodb.com/subscriptions/end-of-life-notice/ Please upgrade to a more recent (and supported) version of ArangoDB or continue using arangojs 8.3.0 until you are able to upgrade. If you can replicate this problem with ArangoDB 3.10 or 3.11, please feel free to re-open this issue. |
I tested with ArangoDB 3.11.6 and the JavaScript driver still reports the same problem. |
For the life of me I can't replicate this with ArangoDB 3.11 and the latest driver version. Note that the driver changed from PUT to POST in a recent release so the message does not make any sense. Are you sure that the code you are running is using the driver version you think you are using? if it's using an older version (e.g. via a nested dependency) that would explain the error. |
FWIW I'm using the following to replicate this:
This results in multiple requests to fetch consecutive batches, so it would trigger this error. |
I used NPM to install the driver in a NodeJS server. I checked the package.json file in the node_modules/arangojs/ folder for the version. Any version after 8.3.0 will have this error. I have not tracked down the actual line that throws the error, but I guess that I need to. I have several servers using the arangojs, and they are all using pre 8.4.0 which is the version that the error first occurred. I will debug the query and step into the driver source to find the error. |
I've tracked it down to line 435 of the connection.js file. Here it is building the Promise for the request. The default method is "GET" and I couldn't tell if a method was specified or not and the Promise is run and throws the error during execution. It is on the second iteration of the flatmap method in the cusror.js file, when it is callin the _more method at line 78. Line 81 of cursor.js does use the POST method on the request, but I think somewhere along the line the method is lost and the default in the connection.js file uses GET. There are a lot of places where the default uses GET within the entire code base and if POST is required, then there could be issues where the method gets lost and the default uses GET. |
I added precaptureStackTraces when creating the Database and this is the error information that I got:
Has something to do with batches and the hasNext flag (I think). |
Can you modify your local copy of the module to log the request method at each step? If the request that is sent out uses the wrong method, it should change at some point. |
The screenshots seem to confirm arangojs sends a POST request. It also looks like the ArangoDB deployment is running locally. My best guess would be that something between arangojs and ArangoDB messes with the request but I'm not sure what that would be. |
This only started with version 8.4.0 of the driver when you went from PUT to POST. If I use version 8.3.0 of the driver everything works as expected, so I don't think there is anything external affecting the request. |
@DougGarno55 Thanks for your diagnostics and workaround. I have experienced the exact issue and downgrading the arangojs driver to 8.3.0 fixes the problem for now. Hopefully there is a fundamental fix soon. |
Can you reproduce this problem in arangojs v9? |
If I try to get records greater than 1,000, I get the "expecting POST /_api/cursor" error when I call the cursor.all() method in ArangoDB.js.
Here is my installation: ArangoDB version 3.11.3 ArangoDB.js versioin 8.6.0 Node.js version 18.14.0
If I add 'LIMIT 1000' to the query, everything works as expected. If I add 'LIMIT 1001' or anything over 1,000 I get the error.
My Test database has one collection (FOICU) with 5,000 documents and only one attribute (CU_NAME).
To replicate:
I've tried this on multiple databases, multiple collections all with the same result.
The text was updated successfully, but these errors were encountered: