argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
18.06k stars 5.52k forks source link

`/extensions.js` -- `500` `Internal error` #12135

Open jsoref opened 1 year ago

jsoref commented 1 year ago

Checklist:

Describe the bug

Chrome shows an error in the console for a text response for a js file.

The web server is sending a 500 text/plain message w/ Internal error as a response to a javascript include -- and the web browser is pissed that the script it requested did not result in a javascript file:

https://github.com/argoproj/argo-cd/blob/b2a6387ca05f7f4e4d31ab057a8d3dc7f741e7ad/server/server.go#L1021-L1022

To Reproduce

Visit the login page when credentials (github dex oauth?) have expired and open browser web tools

Expected behavior

Serve a JavaScript file with the error inline in some form that doesn't result in errors from the browser.

Possibly:

/* Internal Error */

Screenshots

Version

{
    "Version": "v2.4.11+3d9e9f2",
    "BuildDate": "2022-08-22T09:13:16Z",
    "GitCommit": "3d9e9f2f95b7801b90377ecfc4073e5f0f07205b",
    "GitTreeState": "clean",
    "GoVersion": "go1.18.5",
    "Compiler": "gc",
    "Platform": "linux/amd64",
    "KustomizeVersion": "v4.4.1 2021-11-11T23:36:27Z",
    "HelmVersion": "v3.8.1+g5cb9af4",
    "KubectlVersion": "v0.23.1",
    "JsonnetVersion": "v0.18.0"
}

Logs

time="2023-01-25T18:11:59Z" level=error msg="Failed to walk extensions directory: failed to iterate files in '/tmp/extensions/': lstat /tmp/extensions/: no such file or directory"
GET https://argocd.instance/extensions.js net::ERR_ABORTED 500
argocd:1 Refused to execute script from 'https://argocd.instance/extensions.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.

curl yields:

< HTTP/2 500
< date: Wed, 25 Jan 2023 18:37:08 GMT
< content-type: text/plain; charset=utf-8
< content-length: 15
< x-content-type-options: nosniff
< strict-transport-security: max-age=31536000; includeSubDomains; preload
<
Internal error
* Connection #0 to host argocd.glaypen.garnercorp.com left intact
oleghind commented 1 year ago

I am getting the same error, any workaround?

jsoref commented 1 year ago

The code is here: https://github.com/argoproj/argo-cd/blob/b6cfe676f3ff9f73c71a0d6256c1bc14cd9c12ed/server/server.go#L1022-L1024

I suspect that you could "work around" this by adding some extension content.