简体   繁体   English

网络相关问题未登录哨兵平台

[英]Network related issues are not getting logged on sentry platform

I have integrated Sentry into one of my Next.JS application and I'm also able to see JavaScript related errors like reference or syntax error on Sentry platform.我已将 Sentry 集成到我的一个 Next.JS 应用程序中,我还能够在 Sentry 平台上看到 JavaScript 相关错误,例如参考或语法错误。

Though sentry is not logging any.network related errors on their platform.虽然哨兵没有在他们的平台上记录任何与网络相关的错误。 Got 403 Forbidden, 404 Not found and 500 internal server error on my.network calls, but sentry did not reported any of those.在 my.network 调用上出现 403 Forbidden、404 Not found 和 500 internal server error,但 sentry 没有报告任何这些错误。

I have used the following steps for the setup:我已使用以下步骤进行设置:

  1. Installed the SDK using this command npm install --save @sentry/nextjs使用此命令npm install --save @sentry/nextjs
  2. Used the wizard automate the initial steps using this command npx @sentry/wizard -i nextjs使用向导使用此命令自动执行初始步骤npx @sentry/wizard -i nextjs
  3. Added all configurations from next.config.js to next.config.wizardcopy.js添加了从 next.config.js 到 next.config.wizardcopy.js 的所有配置
  4. Deleted next.config.wizardcopy.js and renamed next.config.wizardcopy.js to next.config.js删除了 next.config.wizardcopy.js 并将 next.config.wizardcopy.js 重命名为 next.config.js

I have initialised Sentry both in my client and server file like this我已经像这样在我的客户端和服务器文件中初始化了哨兵

Sentry.init({
  dsn: '***',
  integrations: [
    new CaptureConsole()
  ],
  tracesSampleRate: 1.0
});

I have used CaptureConsole method to capture all errors which are there on console and checked on sentry docs and different online available resources for.network related errors but got no help.我已经使用 CaptureConsole 方法捕获控制台上存在的所有错误,并检查了哨兵文档和不同的在线可用资源以查找与网络相关的错误,但没有得到任何帮助。

Could anybody please help me on the same, what can I more use to get.network related errors.任何人都可以帮我解决这个问题,我还能用什么来解决与网络相关的错误。 In case, if it is not possible, let me know that as well.以防万一,如果不可能,也请告诉我。

In my case I am using reactjs, I added new BrowserTracing() as well.在我的例子中,我使用的是 reactjs,我也添加了new BrowserTracing() You can try this你可以试试这个

import * as Sentry from "@sentry/react";
import { CaptureConsole } from "@sentry/integrations";
import { BrowserTracing } from "@sentry/tracing";

Sentry.init({
    dsn: "https://e44884be8781480fa50344a421e5aaba@o4504315282653184.ingest.sentry.io/4504315339210752",
    integrations: [
        new CaptureConsole(),
        new BrowserTracing()
    ],

    // Set tracesSampleRate to 1.0 to capture 100%
    // of transactions for performance monitoring.
    // We recommend adjusting this value in production
    tracesSampleRate: 1.0,
});

The issue was I have used try catch statements on my code there while handling the xhr request and sentry does not log errors which are already handled (used try catch statements), one have to manually log errors on sentry using captureException method in that case问题是我在处理 xhr 请求时在我的代码上使用了 try catch 语句,而哨兵不记录已经处理过的错误(使用 try catch 语句),在这种情况下,必须使用 captureException 方法在哨兵上手动记录错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM