Closed destinyzju closed 3 years ago
Was there any more detailed output in the service? The reason for that error should be logged in the service console output.
Sorry for didn't make the question clearly.
Create a DB: curl https://localhost:3000/db/docstore -d "create=true" -d "type=docstore"
Add an entry : curl -X POST https://localhost:3000/db/docstore/put -H "Content-Type: application/json" -d '{"_id":1, "value": "test"}'
Query the data: curl -X GET https://localhost:3000/db/docstore/1 These steps return expected result as the examples.
Restart the orbit-db-http-api service
Query the data again: curl -X GET https://localhost:3000/db/docstore/1 I got the error this time.
It looks like the data is lost.
After you do step 4, can you attach the service to view its logs? It will print a far more detailed message to the console then just a basic http 500 error. I think possibly what is happening here is the service does not automatically reopen the store you created earlier. You need to save the db address from the response when you create it and then send another post to open the same address after the restart.
On Wed, Nov 4, 2020 at 1:15 PM destinyzju notifications@github.com wrote:
Sorry for didn't make the question clearly.
1.
Create a DB: curl https://localhost:3000/db/docstore -d "create=true" -d "type=docstore" 2.
Add an entry : curl -X POST https://localhost:3000/db/docstore/put -H "Content-Type: application/json" -d '{"_id":1, "value": "test"}' 3.
Query the data: curl -X GET https://localhost:3000/db/docstore/1 These steps return expected result as the examples. 4.
Restart the orbit-db-http-api service 5.
Query the data again: curl -X GET https://localhost:3000/db/docstore/1 I got the error this time.
It looks like the data is lost.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/orbitdb/orbit-db-http-api/issues/37#issuecomment-721473098, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCTEMZNH2SAZIDEYKPVMHLSOC2KVANCNFSM4TIKJKSQ .
The DB needs to be reopen after the api service is restarted i.e. curl https://localhost:3000/db/docstore -d "create=false" -d "type=docstore". After that I can get the data entry correctly. Thanks.
After restart the API service, 'curl -X GET https://localhost:3000/db/docstore/1' reports '{"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred"}'. It looks like the previously set data was lost after the restart. How can I keep the data? Thanks.