{"id":15646740,"url":"https://github.com/octalmage/gatsby-plugin-sentry","last_synced_at":"2025-04-14T22:45:16.051Z","repository":{"id":57244760,"uuid":"107895019","full_name":"octalmage/gatsby-plugin-sentry","owner":"octalmage","description":"Gatsby plugin to add Sentry error tracking to your site.","archived":false,"fork":false,"pushed_at":"2019-06-21T23:50:40.000Z","size":40,"stargazers_count":47,"open_issues_count":12,"forks_count":15,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T08:32:27.020Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/octalmage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-22T19:13:52.000Z","updated_at":"2024-03-19T10:31:03.000Z","dependencies_parsed_at":"2022-09-01T06:12:11.078Z","dependency_job_id":null,"html_url":"https://github.com/octalmage/gatsby-plugin-sentry","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octalmage%2Fgatsby-plugin-sentry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octalmage%2Fgatsby-plugin-sentry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octalmage%2Fgatsby-plugin-sentry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octalmage%2Fgatsby-plugin-sentry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/octalmage","download_url":"https://codeload.github.com/octalmage/gatsby-plugin-sentry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248975293,"owners_count":21192199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T12:14:23.970Z","updated_at":"2025-04-14T22:45:16.029Z","avatar_url":"https://github.com/octalmage.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gatsby-plugin-sentry\n\nGatsby plugin to add Sentry error tracking to your site.\n\nLearn more about Sentry [here](https://sentry.io).\n\n## Install\n\n`npm install --save gatsby-plugin-sentry`\n\n## How to use\n\n```javascript\n// In your gatsby-config.js\nplugins: [\n  {\n    resolve: \"gatsby-plugin-sentry\",\n    options: {\n      dsn: \"YOUR_SENTRY_DSN_URL\",\n      // Optional settings, see https://docs.sentry.io/clients/node/config/#optional-settings\n      environment: process.env.NODE_ENV,\n      enabled: (() =\u003e [\"production\", \"stage\"].indexOf(process.env.NODE_ENV) !== -1)()\n    }\n  }\n];\n```\n\nNow `Sentry` is available in global window object. so you can use it in `react 16` like:\n\n```javascript\nexport default class ErrorBoundary extends React.Component {\n  \n  constructor(props) {\n    super(props);\n    this.state = { error: null };\n  }\n\n  componentDidCatch(error, errorInfo) {\n    this.setState({ error });\n    Sentry.configureScope((scope) =\u003e {\n      Object.keys(errorInfo).forEach(key =\u003e {\n        scope.setExtra(key, errorInfo[key]);\n      });\n    });\n    Sentry.captureException(error);\n  }\n\n  render() {\n    if (this.state.error) {\n      // render fallback UI\n      return \u003ch1\u003eSomething went wrong!\u003c/h1\u003e;\n    } else {\n      // when there's not an error, render children untouched\n      return this.props.children;\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foctalmage%2Fgatsby-plugin-sentry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foctalmage%2Fgatsby-plugin-sentry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foctalmage%2Fgatsby-plugin-sentry/lists"}