Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Unknown response from server #48

Open
Nortberg opened this issue Dec 22, 2021 · 5 comments
Open

Unknown response from server #48

Nortberg opened this issue Dec 22, 2021 · 5 comments

Comments

@Nortberg
Copy link

Nortberg commented Dec 22, 2021

Hi, I'm a fan of Your project so i have downloaded it and started the server like that
node --inspect src/cli.js api --ipfs-host localhost --no-https --orbitdb-dir /xxx/orbitdb
or even with certs
sudo node src/cli.js api --ipfs-host localhost--no-https --orbitdb-dir /xxx/orbitdb --https-cert /etc/xxx/fullchain.pem --https-key /etc/xxx/privkey.pem

running on port 3000

sending requests;
curl http://localhost:3000/dbs > tmpfile.rsp
or
curl -X POST http://localhost:3000/db/counter -d "create=true" -d "type=counter" > tmpfile.rsp

I get always this;
^@^@^@^D^@^@^@^@^@^@^@^H^G^@^@^@^@^@^@^@^@^@^@^@^@^B

I understand that --no-https parameter is to let OrbitDB API, to connect to ipfs local node without SSL cert. via http:
and
--https-cert and --https-key is to setup OrbitDB API with https endpoints on port 3000 in that case,
and those parameters are not required so I can manage SSL by myself (nginx for example)
that lets me improve speed on local environment.

Am I right?

What is interesting I was also trying docker pull orbitdb/orbit-db-http-api:latest
docker run --net host orbitdb/orbit-db-http-api src/cli.js api --ipfs-host=127.0.0.1 --no-https --orbitdb-dir=/mnt/disks/ipfs-disk/orbitdb-img
or
docker run --net host orbitdb/orbit-db-http-api src/cli.js local --no-https --orbitdb-dir=/mnt/disks/ipfs-disk/orbitdb-img
and i see the same response;
^@^@^@^D^@^@^@^@^@^@^@^H^G^@^@^@^@^@^@^@^@^@^@^@^@^B

After a while I found that there is a problem with --http2 possibly default config.
All is running on Google Cloud
Can You guys investigate

@phillmac
Copy link
Contributor

The default is to run with http2 enabled.
If you want to disable it the arg is --http1 not --http2.
Can you give this a go and report back please?

@Nortberg
Copy link
Author

Nortberg commented Dec 23, 2021

Hi.
Thank You for fast response
Confirm, --http1 works fine. both docker image and just node.
Looks like --http2 in curl version 7.55.1 and 7.58 was playing on my nerves.

Wondering where is the reason; in lib or in my sys config.
Can I use some param to run Api in debug mode, [node is not my natural language]
This might help me to analyze that in future.
LOCAL mode works fine but API not:

As I can see now in api mode;
curl -X POST http://127.0.0.1:3000/db/docstore -d "create=true" -d "type=docstore" --output -

Answering with;
{"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred"}

And on api node side;
========started as Docker
Opening db docstore
IPFSAccessController.save ERROR: { HTTPError: Invalid byte while expecting start of value: 0xa1
at Object.errorHandler [as handleError] (/api/node_modules/ipfs-http-client/src/lib/core.js:67:15)
at process._tickCallback (internal/process/next_tick.js:68:7)
name: 'HTTPError',
response:
Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
[Symbol(Response internals)]:
{ url:
'http://127.0.0.1:5001/api/v0/dag/put?format=dag-cbor&input-enc=raw&only-hash=false&hash=sha2-256',
status: 500,
statusText: 'Internal Server Error',
headers: [Headers],
counter: 0 } } }

======started as nodejs
Server running on port 3000
Opening db docstore
IPFSAccessController.save ERROR: HTTPError: Invalid byte while expecting start of value: 0xa1
at Object.errorHandler [as handleError] (/home/gb/orbit-db-http-api/node_modules/ipfs-http-client/src/lib/core.js:67:15)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Client.fetch (/home/gb/orbit-db-http-api/node_modules/ipfs-utils/src/http.js:155:9)
at async Object.put (/home/gb/orbit-db-http-api/node_modules/ipfs-http-client/src/dag/put.js:75:17)
at async Object.writeCbor [as write] (/home/gb/orbit-db-http-api/node_modules/orbit-db-io/index.js:69:15)
at async IPFSAccessController.save (/home/gb/orbit-db-http-api/node_modules/orbit-db-access-controllers/src/ipfs-access-controller.js:46:13)
at async Function.create (/home/gb/orbit-db-http-api/node_modules/orbit-db-access-controllers/src/access-controllers.js:68:20)
at async OrbitDB._determineAddress (/home/gb/orbit-db-http-api/node_modules/orbit-db/src/OrbitDB.js:334:37)
at async OrbitDB.create (/home/gb/orbit-db-http-api/node_modules/orbit-db/src/OrbitDB.js:357:23)
at async DBManager.get (/home/gb/orbit-db-http-api/src/lib/db-manager.js:26:22) {
response: Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
[Symbol(Response internals)]: {
url: 'http://localhost:5001/api/v0/dag/put?format=dag-cbor&input-enc=raw&only-hash=false&hash=sha2-256',
status: 500,
statusText: 'Internal Server Error',
headers: [Headers],
counter: 0
}
}
}

@phillmac
Copy link
Contributor

phillmac commented Dec 23, 2021 via email

@Nortberg
Copy link
Author

I was using both curl on google console and curl on my ubuntu laptop but now i see that there is some problem like above
'''''''''
IPFSAccessController.save ERROR: HTTPError: Invalid byte while expecting start of value: 0xa1
at Object.errorHandler [as handleError] (/home/gb/orbit-db-http-api/node_modules/ipfs-http-client/src/lib/core.js:67:15)
''''''''''

seems like some formatting 0xa1 => 161 =>ansci [~i]
Can You help me with that?

@spriyabalan
Copy link

I am facing exactly the same issue. Kinldy let me know if you were able to fix his.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants