Skip to content
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

service-to-service call fails with 400 bad request #4553

Open
javageek79 opened this issue Apr 26, 2022 · 8 comments
Open

service-to-service call fails with 400 bad request #4553

javageek79 opened this issue Apr 26, 2022 · 8 comments
Labels
kind/bug Something isn't working P1 size/XS 2 days work triaged/resolved Indicates that this issue has been triaged

Comments

@javageek79
Copy link

In what area(s)?

/area runtime

/area operator

/area placement

/area docs

/area test-and-release

What version of Dapr?

1.7.3

Expected Behavior

Service-to-service calls work as before

Actual Behavior

The call works with 1.6.2 and fails with latest patch release.

Inner cause is

Caused by: io.dapr.exceptions.DaprException: UNKNOWN: <!doctype html><html lang="en"><head><title>HTTP Status 400 – Bad Request</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 – Bad Request</h1></body></html>
	at io.dapr.client.DaprHttp.parseDaprError(DaprHttp.java:333)
	at io.dapr.client.DaprHttp.access$200(DaprHttp.java:47)
	at io.dapr.client.DaprHttp$ResponseFutureCallback.onResponse(DaprHttp.java:365)
	... 4 common frames omitted

Steps to Reproduce the Problem

Create a invoke call with

//...
daprInvoker.invokeMethod(properties.getDaprAppId(), methodToInvoke, body, createPostExtension())
//...
private HttpExtension createPostExtension() {
        return new HttpExtension(DaprHttp.HttpMethods.POST, Map.of(), Map.of(
                HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE
        ));
    }

Release Note

RELEASE NOTE:

@javageek79 javageek79 added the kind/bug Something isn't working label Apr 26, 2022
@artursouza artursouza added P0 size/XS 2 days work triaged/resolved Indicates that this issue has been triaged labels Apr 26, 2022
@artursouza
Copy link
Member

I talked to @javageek79 via e-mail so he does not disclose business info here. The issue is that the URL passing from SDK to runtime contains %2F instead of /

This was fixed in the latest release of the Java SDK: dapr/java-sdk#702

@artursouza artursouza added P1 and removed P0 labels Apr 26, 2022
@yaron2
Copy link
Member

yaron2 commented Apr 26, 2022

Do we move this to the Java SDK repo then?

@artursouza
Copy link
Member

Not yet. We are validating if the latest Java SDK is compatible with the previous runtime (1.6.x) for service invocation containing "/".

@pravinpushkar
Copy link
Contributor

pravinpushkar commented Apr 27, 2022

Summary of tests executed -

Runtime- 1.6.2 and java-sdk 1.5.0
caller method name - "/say/test"
expected callee mapping - "/say/test"

caller method name - "/say/method1%2F111/test"
here %2F is converted to "/" and thus callee expects a mapping "/say/method1/111/test"

Runtime- 1.7.2 and java-sdk 1.5.0
caller method name - "/say/method1%2F111/test"
here %2F is not converted to "/" and thus callee expects a mapping "/say/method1%2F111/test"

@javageek79
Copy link
Author

Hi @pravinpushkar, does this mean, sdk 1.5.0 is compatible with rt 1.6.2?

@pravinpushkar
Copy link
Contributor

pravinpushkar commented Apr 27, 2022

@javageek79 We can say it is compatible, only thing is it needs to have the fix #4008 for not decoding the %2F. Only if you have this particular way of method naming(method1%2F111), then you must have this fix. Otherwise, there should not be any issue.

Can you please verify this at your end also?

@javageek79
Copy link
Author

As said, our preferred setup would be,

  1. step, run runtime v1.6.2 with sdks 1.5 or 1.4
  2. step, run runtime v1.7.2 with sdk 1.5

If those scenarios are possible, it's all fine.

@pravinpushkar
Copy link
Contributor

Could you please verify with SDK 1.5 and runtime v1.7.2 or v1.6.2.
These should be fine unless you have method names with %2F character like method1%2F111. If this is the case then you will need runtime version v1.7.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working P1 size/XS 2 days work triaged/resolved Indicates that this issue has been triaged
Projects
None yet
Development

No branches or pull requests

4 participants