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

<groovy/> sets empty Response in the Response flow, when exc.getResponse() == null #761

Open
rrayst opened this issue Oct 16, 2023 · 6 comments
Milestone

Comments

@rrayst
Copy link
Contributor

rrayst commented Oct 16, 2023

This leads to

            <groovy>
                println exc.getRequest().getUri()
            </groovy>

producing weird 200 OK responses in error cases.

(This is due to:

)

@predic8
Copy link
Member

predic8 commented Nov 7, 2023

@t-burch Test and post how the wired response looks like (test with curl).

I do not know if we should change something. Cause this might not the only Interceptor. Maybe we should check in the Transport if response==null and then provide an error message?

@t-burch
Copy link
Collaborator

t-burch commented Jul 1, 2024

In what circumstance does it set the 200 OK response, how can one reproduce that

@predic8 predic8 added this to the 5.8.0 milestone Dec 9, 2024
@predic8
Copy link
Member

predic8 commented Dec 9, 2024

Remove setting 200 OK

@predic8
Copy link
Member

predic8 commented Dec 16, 2024

@rrayst I cannot reproduce the error and I can't find anything in GroovyInterceptor that could lead to this behaviour.

@predic8 predic8 modified the milestones: 5.8.0, 6.0.0 Dec 18, 2024
@predic8
Copy link
Member

predic8 commented Dec 18, 2024

No it returns:

< HTTP/1.1 500 Internal Server Error
< Content-Length: 296
< Content-Type: application/problem+json
<
{
  "message" : null,
  "source" : "throw new RuntimeException()",
  "note" : "To hide error details set Membrane into production mode. In proxies.xml use <router production=\"true\">..</router>.\");\n",
  "type" : "https://membrane-api.io/error/internal",
  "title" : "Error executing script."
* Connection #0 to host localhost left intact
}

@predic8 predic8 closed this as completed Dec 18, 2024
@rrayst
Copy link
Contributor Author

rrayst commented Dec 23, 2024

<spring:beans xmlns:spring="http://www.springframework.org/schema/beans"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns="http://membrane-soa.org/proxies/1/"
              xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
					    http://membrane-soa.org/proxies/1/ http://membrane-soa.org/schemas/proxies-1.xsd">

    <spring:bean id="demoError" class="com.predic8.membrane.core.interceptor.RegExReplaceInterceptor" />

    <router>

        <api port="2000">
            <groovy>
                println exc.getRequest().getUri()
            </groovy>
            <spring:ref bean="demoError" />
            <target host="api.predic8.de" />
        </api>

    </router>

</spring:beans>

(Use any interceptor producing an uncaught Exception after groovy - here: a RegExReplaceInterceptor which has not all properties set.)

http://localhost:2000/ returns "200 OK".

@rrayst rrayst reopened this Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants