Sage-Bionetworks / sage-monorepo

Where OpenChallenges, Schematic, and other Sage open source apps are built
https://sage-bionetworks.github.io/sage-monorepo/
Apache License 2.0
21 stars 12 forks source link

[Bug] Identify and fix broken org logos (only 4xx errors) #1538

Closed tschaffter closed 1 year ago

tschaffter commented 1 year ago

Is there an existing issue for this?

What projects are you seeing the problem on?

OpenChallenges

Current behavior

  1. Open the browser console > Network (FF) to see the requests made by the web client
  2. Open the organization search page
  3. Iterate over the pages while keeping an eye on the console for images that failed to load

Example of image that fail:

Note

Errors that I have seen include 400 and 500. One test that can be performed is to copy-paste the url from the console into another tag so see if the logo appears. Looking at the logs from the API gateway, image service and thumbor may help figuring out the issue.

docker logs -f openchallenges-api-gateway
docker logs -f openchallenges-image-service
docker logs -f openchallenges-thumbor

image

Expected behavior

No response

Anything else?

No response

Commit ID

https://github.com/Sage-Bionetworks/sage-monorepo/pull/1506

Are you developing inside the dev container?

Code of Conduct

tschaffter commented 1 year ago

Some 500 errors originate from the API gateway?

This link failed when loading the page with error 500, but the image displayed property when I copy-pasted the link to a new tab.

http://localhost:8082/img/6a-PISW9FMkzhLMIbdFcAhua2_0=/250x250/logo/institut-curie.jpg

timestamp | "2023-05-12T03:10:06.271+00:00" -- | -- path | "/img/6a-PISW9FMkzhLMIbdFcAhua2_0=/250x250/logo/institut-curie.jpg" status | 500 error | "Internal Server Error" requestId | "6f6d565c-15618"

The logs of the API gateway container show the error:

2023-05-12 02:38:45 ERROR [reactor-http-epoll-7] o.s.b.a.w.r.e.AbstractErrorWebExceptionHandler - [88a20189-13739]  500 Server Error for HTTP GET "/img/6a-PISW9FMkzhLMIbdFcAhua2_0=/250x250/logo/institut-curie.jpg"
reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response
        Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
        *__checkpoint ? org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain]
        *__checkpoint ? org.springframework.security.web.server.authorization.AuthorizationWebFilter [DefaultWebFilterChain]
        *__checkpoint ? org.springframework.security.web.server.authorization.ExceptionTranslationWebFilter [DefaultWebFilterChain]
        *__checkpoint ? org.springframework.security.web.server.authentication.logout.LogoutWebFilter [DefaultWebFilterChain]
        *__checkpoint ? org.springframework.security.web.server.savedrequest.ServerRequestCacheWebFilter [DefaultWebFilterChain]
        *__checkpoint ? org.springframework.security.web.server.context.SecurityContextServerWebExchangeWebFilter [DefaultWebFilterChain]
        *__checkpoint ? org.springframework.security.web.server.ui.LogoutPageGeneratingWebFilter [DefaultWebFilterChain]
        *__checkpoint ? org.springframework.security.web.server.ui.LoginPageGeneratingWebFilter [DefaultWebFilterChain]
        *__checkpoint ? org.springframework.security.web.server.authentication.AuthenticationWebFilter [DefaultWebFilterChain]
        *__checkpoint ? org.springframework.security.oauth2.client.web.server.authentication.OAuth2LoginAuthenticationWebFilter [DefaultWebFilterChain]
        *__checkpoint ? org.springframework.security.oauth2.client.web.server.OAuth2AuthorizationRequestRedirectWebFilter [DefaultWebFilterChain]
        *__checkpoint ? org.springframework.security.web.server.context.ReactorContextWebFilter [DefaultWebFilterChain]
        *__checkpoint ? org.springframework.security.web.server.header.HttpHeaderWriterWebFilter [DefaultWebFilterChain]
        *__checkpoint ? org.springframework.security.config.web.server.ServerHttpSecurity$ServerWebExchangeReactorContextWebFilter [DefaultWebFilterChain]
        *__checkpoint ? org.springframework.security.web.server.WebFilterChainProxy [DefaultWebFilterChain]
        *__checkpoint ? org.springframework.cloud.sleuth.instrument.web.TraceWebFilter [DefaultWebFilterChain]
        *__checkpoint ? org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter [DefaultWebFilterChain]
        *__checkpoint ? HTTP GET "/img/6a-PISW9FMkzhLMIbdFcAhua2_0=/250x250/logo/institut-curie.jpg" [ExceptionHandlingWebHandler]

The logs of Thumbor does not show any trace of error for the above image, indicating that the issue did not come from Thumbor.

tschaffter commented 1 year ago

The images that I see breaking in my PR are also breaking in main.

tschaffter commented 1 year ago

Consider extra checks we could implement to prevent images from breaking (e.g. enforcing UTF8 char in SQL data?).