-
Notifications
You must be signed in to change notification settings - Fork 42
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
bug: REST relay publish returns HTTP 500 Internal Server Error instead of 4XX for invalid requests #914
Comments
If you are getting this error, it must be because there is no peer connected for the pubsubTopic that you are trying to publish the messages. Can you share logs for this test? |
Yes, the peers are connected on a different pubsubTopic. The one I get now, |
Got it, Thanks. Anyways added a check to verify is pubsubTopic subscription is there or not in the linked PR. |
As per discussion here https://discord.com/channels/1110799176264056863/1176811954598330378 , there is no requirement of topic subscription in order to publish to it. Which means, as long as there are enough peers connected to a pubsubTopic we should be able to publish to it without subscribing. Will revert related changs in #919 accordingly. |
@fbarbu15 , closing this issue as the respective PR is merged. Please retest and reopen if required. |
Describe the bug
For invalid requests it's better to have some meaningful error codes/messages. HTTP 500 Internal Server Error is misleading and inconsistent with RPC protocol or REST on NWAKU.
To Reproduce
relay/v1/messages/
=> HTTP 500 instead of 4XX
relay/v1/messages/
=> HTTP 500 instead of 4XX
Comparisons between REST/RCP and NWAKU to see inconsistency
Added comments for those that don't seem correct. However the main problem is HTTP 500
For the 1st scenario:
GOWAKU
- min-relay-peers-to-publish=0
:RPC: HTTP 400 (Bad Request):
"error":"no subscription found for content topic"
(should be pubsub topic but this is minor)REST: HTTP 404 (Not Found): not subscribed to topic (would look better: not subscribed to pubsub topic. Also should we return 400 instead of 404 to be consistent with RPC and NWAKU?)
- min-relay-peers-to-publish=1
:RPC:HTTP 400 (Bad Request):
"error":"not enough peers to publish"
(doesn't seem correct as there is 1 peer, problem here is that the node is not subscribed to this pubsub topic )REST:HTTP 500 (Internal Server Error) with no content (definitely not right, I would expect 4XX with
Failed to publish: Node not subscribed to pubsub topic: /waku/2/rs/18/3
)NWAKU
REST: HTTP 400 (Bad Request):
"Failed to publish: Node not subscribed to topic: /waku/2/rs/18/3"
For the 2nd scenario:
GOWAKU
RPC:HTTP 400 (Bad Request):
"error":"missing Payload field"
REST:HTTP 500 (Internal Server Error) with no content (definitely not right, I would expect 4XX with
missing Payload field
)NWAKU(REST)
HTTP 400 (Bad Request): "error":"Invalid content body, could not decode. Unable to deserialize data"
go-waku version/commit hash
wakuorg/go-waku:latest
The text was updated successfully, but these errors were encountered: