hashicorp / hashicorp/nomad

Dispatch endpoint throws 500 on missing required field and uses rpc-formatting

Open
#7,617 1 comment 0 reactions 0 assignees View on GitHub
stage/accepted theme/api type/bug
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

When using the API and running a dispatch command with a missing required meta key Nomad returns:

500, rpc error: Dispatch did not provide required meta keys: [SLEEP_TIME]

However, 400 is probably a better return code:

> 400 BAD REQUEST
> The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

It would also be better for consumers of the API if the format was JSON rather than a pure rpc error.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the API dispatch endpoint and reproducing a dispatch request with the required SLEEP_TIME meta key omitted. Trace the response handling to determine where the RPC error becomes an HTTP response. Done means the missing-field request returns HTTP 400 with a JSON error response rather than a 500 RPC-formatted error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.