nginx:未捕获(承诺)ChunkLoadError:正在加载块

nginx:未捕获(承诺)ChunkLoadError:正在加载块

我安装了Sentry 自托管23.1.1,并将 nginx/1.22.1 配置为前端代理。如果我访问 Docker 端口,Sentry 可以正常加载,而如果我通过 nginx,则会在主题中收到错误。这看起来像是一个应用程序错误,但它可以在没有 nginx 的情况下工作,因此一定是 Web 服务器端出了问题。我提出了一个向 Sentry 本身发出,但配置看起来正确。

我尝试过清除 cookies、私人导航、不同的浏览器……结果都一样。只有在我第一次加载应用程序时才有效,安装后就不再有效了。

在浏览器控制台中发现的完整异常是:

Loading failed for the <script> with source “https://logger.xx.com/_static/dist/sentry/chunks/app_actionCreators_organization_tsx-app_bootstrap_commonInitialization_tsx-app_bootstrap_init-73196b.1fa346ca59b89f776cae.js”. [issues:1:1](https://logger.xx.com/organizations/sentry/issues/)
Uncaught (in promise) ChunkLoadError: Loading chunk app_actionCreators_organization_tsx-app_bootstrap_commonInitialization_tsx-app_bootstrap_init-73196b failed.
(error: [https://logger.xx.com/_static/dist/sentry/chunks/app_ac…zation_tsx-app_bootstrap_init-73196b.1fa346ca59b89f776cae.js](https://logger.xx.com/_static/dist/sentry/chunks/app_actionCreators_organization_tsx-app_bootstrap_commonInitialization_tsx-app_bootstrap_init-73196b.1fa346ca59b89f776cae.js))
    j jsonp chunk loading:27
    e ensure chunk:6
    e ensure chunk:5
    r initializeMain.tsx:14
    async* index.tsx:80
    async* index.tsx:83
    <anonymous> app.js:1
[jsonp chunk loading:27:17](webpack:///webpack/runtime/jsonp%20chunk%20loading)
    r initializeMain.tsx:15
    AsyncFunctionThrow self-hosted:811
    (Async: async)
    <anonymous> index.tsx:80
    AsyncFunctionNext self-hosted:807
    (Async: async)
    <anonymous> index.tsx:83
    <anonymous> app.js:1

nginx 配置:

server {
        listen 443 ssl;
        listen [::]:443 ssl;
        server_name logger.xx.com;
        ssl_certificate /etc/letsencrypt/live/logger.xx.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/logger.xx.com/privkey.pem; # managed by Certbot

        # Some taken from https://github.com/mherrmann/sentry-self-hosted/blob/master/nginx-site
        # keepalive + raven.js is a disaster
        keepalive_timeout 0;

        gzip off;
        proxy_http_version 1.1;
        proxy_redirect off;
        proxy_buffering off;
        proxy_next_upstream error timeout invalid_header http_502 http_503 non_idempotent;
        proxy_next_upstream_tries 2;
        proxy_set_header Connection '';
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Request-Id $request_id;
        proxy_read_timeout 30s;
        proxy_send_timeout 5s;

        root /dati/www/logger.xx.com;
        index index.html;
        access_log /var/log/nginx/logger.xx.com.access.log;
        error_log /var/log/nginx/logger.xx.com.error.log error;

        location / {
                proxy_pass http://127.0.0.1:9012;
        }
}

谢谢

相关内容