Pushing invoice to a bad server returns "Invoice not found"
Per @itowlson:
If I push to a bad server, I appear to get an "Invoice was not found" error from the Bindle client lib, which seems misleading. Is this expected / a known issue? Or am I doing something wrong?
This is the error I get:
$ hippo bindle . -s http://fake.example.com/v1
Error: Error pushing bindle to server: Error creating request
So I'll move this issue over to Hippo-CLI
The misleading message occurs when the client is constructed with http2_prior_knowledge set to false. ~The Bindle CLI never does that; I changed the Hippo CLI to do it on one of the branches, because I thought it might be needed to work with the load balancer on the test server, but I can change it back if we are happy with prior knowledge being assumed by default.~ Correction: the Bindle CLI does now do that, and exhibits the weird error message.
Oh! Okay. That makes sense why I could not reproduce. I will keep working on this one.
Semi-closing the loop on this one:
- With a nonexistent server all is well
- With a server that reliably returns 404 for unknown URLs, this will always produce
Invoice was not found(because the client tries to post to.../_iand that doesn't exist. 404 is is unwrapped to an "invoice was not found" message at https://github.com/deislabs/bindle/blob/219d98dd3dd88e34635523506fe927758ad38c49/src/client/mod.rs#L549 - WIth a server that reliably returns 404 for HTTP/1 but does not handle HTTP/2 without negotiation, you will get the generic "Error creating request" if you go straight to HTTP/2 because you can't talk to the server at all, but "Invoice was not found" if you negotiate because then it gets as far as the 404. I guess
example.comfalls into this category.
So I think the fundamental issue is that the generic status unwrap code always assumes it's an invoice that was not found rather than the general invoice endpoint (or whatever other endpoint).
Alright, that all makes a lot of sense. So the root of the error is that a POST operation's 404 failure is being translated to the error message for a GET operation's error.
