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

Error when use getJsonPayload method and Client.forward() over https #7298

Open
josearivas opened this issue Oct 24, 2024 · 0 comments
Open
Labels
module/http Team/PCM Protocol connector packages related issues Type/Bug

Comments

@josearivas
Copy link

Description

When I use the getJsonPayload method in a passthrough service (Client.forward()) and the backend service is exposed over HTTPS, I get the following error.

time=2024-10-21T08:21:40.885-04:00 level=ERROR module=ballerina/http message="unhandled error returned from the service" error={"causes":[],"message":"Bad Gateway","detail":{"statusCode":502,"headers":{"alt-svc":["h3=":443"; ma=2592000"],"content-length":["0"],"date":["Mon, 21 Oct 2024 12:21:40 GMT"],"server":["Caddy"],"x-http2-stream-id":["3"]},"body":()},"stackTrace":[{"callableName":"createResponseError","moduleName":"ballerina.http.2","fileName":"http_client_endpoint.bal","lineNumber":676},{"callableName":"processResponse","moduleName":"ballerina.http.2","fileName":"http_client_endpoint.bal","lineNumber":706},{"callableName":"processForward","moduleName":"ballerina.http.2.Client","fileName":"http_client_endpoint.bal","lineNumber":371}]} path="/api/proxy" method="POST"

The error does not occur when I use the getTextPayload method instead of getJsonPayload. And the error also does not occur when I use the getJsonPayload method and the endpoint backend is exposed via http.

Steps to Reproduce

  1. Create the api
import ballerina/http;
import ballerina/io;

http:Client clientEP = check new ("https://micarro2.free.beeceptor.com");

service /api on new http:Listener(8080) {

    resource function post proxy(http:Request req) returns anydata|error {
        json payloadOrig = check req.getJsonPayload();
        io:println(payloadOrig);

        anydata response = check clientEP->forward("/proxy", req);
        return response;
    }
}
  1. Run with bal run

Version

ballerina:2201.9.0

Environment Details (with versions)

Image ballerina/ballerina:2201.9.0
Docker version 20.10.12
WSL 2
Windows 11 Pro

@TharmiganK TharmiganK added module/http Team/PCM Protocol connector packages related issues labels Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/http Team/PCM Protocol connector packages related issues Type/Bug
Projects
None yet
Development

No branches or pull requests

2 participants