{
    "componentChunkName": "component---src-templates-article-page-template-js",
    "path": "/ftw/how-to-set-up-sentry/",
    "result": {"data":{"markdownRemark":{"frontmatter":{"title":"How to set up Sentry to log errors in FTW","slug":"how-to-set-up-sentry","updated":"2019-01-25T00:00:00.000Z","category":"ftw-testing-error-handling","ingress":"This guide documents how to use Sentry to log errors in Flex Template for Web (FTW).","skills":null},"htmlAst":{"type":"root","children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"FTW supports error logging with "},{"type":"element","tagName":"a","properties":{"href":"https://sentry.io/","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"Sentry"}]},{"type":"text","value":" out of the\nbox provided that required environment variables are set in place. Other\nlogging solutions can also be used but the Sentry client comes already\nstrapped into application."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"configure-the-sentry-dsn-variable","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#configure-the-sentry-dsn-variable","ariaLabel":"configure the sentry dsn variable permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Configure the Sentry DSN variable"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"To enable the Sentry error logging a DSN, "},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"Data Source Name"}]},{"type":"text","value":" has to be\nprovided as an environment variable. Browser and Node environments both\nuse the same "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"REACT_APP_SENTRY_DSN"}]},{"type":"text","value":" variable."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The DSN key can be aquired from the Sentry project settings. To test it\nin your local environment it can be passed for example to the\n"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"yarn run dev-server"}]},{"type":"text","value":" command:"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"bash"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-bash"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","assign-left","variable"]},"children":[{"type":"text","value":"REACT_APP_SENTRY_DSN"}]},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"element","tagName":"span","properties":{"className":["token","string"]},"children":[{"type":"text","value":"'<sentry-dsn>'"}]},{"type":"text","value":"  "},{"type":"element","tagName":"span","properties":{"className":["token","function"]},"children":[{"type":"text","value":"yarn"}]},{"type":"text","value":" run dev-server"}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"If the Sentry DSN key is not provided the template app will log errors\nto the console. The logging and Sentry setup is implemented in\n"},{"type":"element","tagName":"a","properties":{"href":"https://github.com/sharetribe/flex-template-web/blob/master/src/util/log.js","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"src/util/log.js"}]},{"type":"text","value":"\nand\n"},{"type":"element","tagName":"a","properties":{"href":"https://github.com/sharetribe/flex-template-web/blob/master/server/log.js","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"server/log.js"}]},{"type":"text","value":"\nso refer to those files to change the external logging service or the\nlogging logic in general."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"optional-configure-source-map-retrieval","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#optional-configure-source-map-retrieval","ariaLabel":"optional configure source map retrieval permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Optional: Configure source map retrieval"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"By default Sentry fetches the source maps for minified javascript files.\nHowever, this might now work in case some sort of authentication, e.g.\nbasic auth, is required to reach your application. To circumvent this a\nsecurity token can be configured to Sentry. Sentry then adds this token\nto the source maps request header so that the server hosting the\nmarketplace can then be configured to let those requests access the\nsource maps."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"For basic auth the security token can be configured as follows:"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"In "},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"Project > Settings > General > Client Security"}]},{"type":"text","value":" set the following\nvalues"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Security token"}]},{"type":"text","value":" - "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"Basic <your username:password in Base 64>"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Security token header"}]},{"type":"text","value":" - "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"Authorization"}]}]},{"type":"text","value":"\n"}]}],"data":{"quirksMode":false}},"headings":[{"value":"Configure the Sentry DSN variable","depth":2},{"value":"Optional: Configure source map retrieval","depth":2}]}},"pageContext":{"slug":"how-to-set-up-sentry","category":"ftw-testing-error-handling"}},
    "staticQueryHashes": ["3794076007","439097193","717698143"]}