mirror of
				https://github.com/jakejarvis/jarv.is.git
				synced 2025-10-27 02:55:47 -04:00 
			
		
		
		
	trying out Sentry logging on /api/hits
This commit is contained in:
		| @@ -1,10 +1,10 @@ | |||||||
| name: Lighthouse | name: Post-Deploy | ||||||
| 
 | 
 | ||||||
| on: | on: | ||||||
|   deployment_status |   deployment_status | ||||||
| 
 | 
 | ||||||
| jobs: | jobs: | ||||||
|   audit: |   release: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|     if: github.event.deployment_status.state == 'success' |     if: github.event.deployment_status.state == 'success' | ||||||
|     env: |     env: | ||||||
| @@ -14,8 +14,14 @@ jobs: | |||||||
|     steps: |     steps: | ||||||
|     - uses: actions/checkout@v2 |     - uses: actions/checkout@v2 | ||||||
|       with: |       with: | ||||||
|         fetch-depth: 2 |         fetch-depth: 0 | ||||||
|         lfs: false |     - uses: getsentry/action-release@v1 | ||||||
|  |       env: | ||||||
|  |         SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | ||||||
|  |         SENTRY_ORG: jakejarvis | ||||||
|  |         SENTRY_PROJECT: jarvis | ||||||
|  |       with: | ||||||
|  |         environment: ${{ github.event.deployment_status.environment }} | ||||||
|     - uses: actions/setup-node@v2 |     - uses: actions/setup-node@v2 | ||||||
|       with: |       with: | ||||||
|         node-version: 12.x |         node-version: 12.x | ||||||
| @@ -1,5 +1,6 @@ | |||||||
| /// <reference types="./types/hits" /> | /// <reference types="./types/hits" /> | ||||||
|  |  | ||||||
|  | import * as Sentry from "@sentry/node"; | ||||||
| import { VercelRequest, VercelResponse } from "@vercel/node"; | import { VercelRequest, VercelResponse } from "@vercel/node"; | ||||||
| import { Client, query as q } from "faunadb"; | import { Client, query as q } from "faunadb"; | ||||||
| import numeral from "numeral"; | import numeral from "numeral"; | ||||||
| @@ -8,6 +9,12 @@ import rssParser from "rss-parser"; | |||||||
|  |  | ||||||
| const baseUrl = "https://jarv.is/"; | const baseUrl = "https://jarv.is/"; | ||||||
|  |  | ||||||
|  | Sentry.init({ | ||||||
|  |   dsn: process.env.SENTRY_DSN || "", | ||||||
|  |   environment: process.env.VERCEL_ENV || process.env.NODE_ENV || process.env.SENTRY_ENVIRONMENT || "", | ||||||
|  |   tracesSampleRate: 1.0, | ||||||
|  | }); | ||||||
|  |  | ||||||
| // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||||||
| export default async (req: VercelRequest, res: VercelResponse) => { | export default async (req: VercelRequest, res: VercelResponse) => { | ||||||
|   try { |   try { | ||||||
| @@ -48,6 +55,8 @@ export default async (req: VercelRequest, res: VercelResponse) => { | |||||||
|     res.status(200).json(result); |     res.status(200).json(result); | ||||||
|   } catch (error) { |   } catch (error) { | ||||||
|     console.error(error); |     console.error(error); | ||||||
|  |     Sentry.captureException(error); | ||||||
|  |     await Sentry.flush(2000); | ||||||
|  |  | ||||||
|     res.status(400).json({ message: error.message }); |     res.status(400).json({ message: error.message }); | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -33,6 +33,8 @@ | |||||||
|     "@fontsource/comic-neue": "4.4.5", |     "@fontsource/comic-neue": "4.4.5", | ||||||
|     "@fontsource/inter": "4.4.5", |     "@fontsource/inter": "4.4.5", | ||||||
|     "@fontsource/roboto-mono": "4.4.5", |     "@fontsource/roboto-mono": "4.4.5", | ||||||
|  |     "@sentry/node": "^6.6.0", | ||||||
|  |     "@sentry/tracing": "^6.6.0", | ||||||
|     "dotenv": "^10.0.0", |     "dotenv": "^10.0.0", | ||||||
|     "faunadb": "fauna/faunadb-js#master", |     "faunadb": "fauna/faunadb-js#master", | ||||||
|     "graphql": "^15.5.0", |     "graphql": "^15.5.0", | ||||||
|   | |||||||
| @@ -17,7 +17,10 @@ | |||||||
|     "typeRoots": [ |     "typeRoots": [ | ||||||
|       "./types", |       "./types", | ||||||
|       "./node_modules/@types" |       "./node_modules/@types" | ||||||
|     ] |     ], | ||||||
|  |     "sourceMap": true, | ||||||
|  |     "sourceRoot": "/", | ||||||
|  |     "inlineSources": true | ||||||
|   }, |   }, | ||||||
|   "exclude": [ |   "exclude": [ | ||||||
|     "node_modules" |     "node_modules" | ||||||
|   | |||||||
							
								
								
									
										109
									
								
								yarn.lock
									
									
									
									
									
								
							
							
						
						
									
										109
									
								
								yarn.lock
									
									
									
									
									
								
							| @@ -1000,6 +1000,74 @@ | |||||||
|     "@nodelib/fs.scandir" "2.1.5" |     "@nodelib/fs.scandir" "2.1.5" | ||||||
|     fastq "^1.6.0" |     fastq "^1.6.0" | ||||||
|  |  | ||||||
|  | "@sentry/core@6.6.0": | ||||||
|  |   version "6.6.0" | ||||||
|  |   resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.6.0.tgz#51661d2dd5023d6cd07467422de1854282ced7e5" | ||||||
|  |   integrity sha512-EjdeT6paAdxAZgfsVCB8wneahQF3nAUt9GxOJxaOBUv8BSc3HQ/svcTU3RU7k8YsP26PseEOIsedaxsEVZ+7og== | ||||||
|  |   dependencies: | ||||||
|  |     "@sentry/hub" "6.6.0" | ||||||
|  |     "@sentry/minimal" "6.6.0" | ||||||
|  |     "@sentry/types" "6.6.0" | ||||||
|  |     "@sentry/utils" "6.6.0" | ||||||
|  |     tslib "^1.9.3" | ||||||
|  |  | ||||||
|  | "@sentry/hub@6.6.0": | ||||||
|  |   version "6.6.0" | ||||||
|  |   resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.6.0.tgz#1b9fa22ee104b7d6afd2dc4c40a1459fda259366" | ||||||
|  |   integrity sha512-1Yw0kbxcvO7njZUDGvCKB6DxU5jQio7Be3Kx5qxwcx8ojpT9lo9p+IYZajgl6zQqkjjbVm/4SoYqU24ozu5vxw== | ||||||
|  |   dependencies: | ||||||
|  |     "@sentry/types" "6.6.0" | ||||||
|  |     "@sentry/utils" "6.6.0" | ||||||
|  |     tslib "^1.9.3" | ||||||
|  |  | ||||||
|  | "@sentry/minimal@6.6.0": | ||||||
|  |   version "6.6.0" | ||||||
|  |   resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.6.0.tgz#48684734e3c380e5e63a9357d05f0c18bae84419" | ||||||
|  |   integrity sha512-xVBlZIDxSvHvNdvD5KmjTf8Xgi78vLpT4xqJaDUkW7B+DqWMVJZe5aUdQmcp7X/zWxctBwyMKsdHO7oiHkpS+Q== | ||||||
|  |   dependencies: | ||||||
|  |     "@sentry/hub" "6.6.0" | ||||||
|  |     "@sentry/types" "6.6.0" | ||||||
|  |     tslib "^1.9.3" | ||||||
|  |  | ||||||
|  | "@sentry/node@^6.6.0": | ||||||
|  |   version "6.6.0" | ||||||
|  |   resolved "https://registry.yarnpkg.com/@sentry/node/-/node-6.6.0.tgz#e535e1e679cf894752810529ffdee93cbfd078f0" | ||||||
|  |   integrity sha512-heKie/AOanYq3mCsKR1igPn1sUIxBmGibBp79Xc0iSAgliPKnnLkqUjvAIKu6mcevL9UOUhpMDLzhilkaG+bAA== | ||||||
|  |   dependencies: | ||||||
|  |     "@sentry/core" "6.6.0" | ||||||
|  |     "@sentry/hub" "6.6.0" | ||||||
|  |     "@sentry/tracing" "6.6.0" | ||||||
|  |     "@sentry/types" "6.6.0" | ||||||
|  |     "@sentry/utils" "6.6.0" | ||||||
|  |     cookie "^0.4.1" | ||||||
|  |     https-proxy-agent "^5.0.0" | ||||||
|  |     lru_map "^0.3.3" | ||||||
|  |     tslib "^1.9.3" | ||||||
|  |  | ||||||
|  | "@sentry/tracing@6.6.0", "@sentry/tracing@^6.6.0": | ||||||
|  |   version "6.6.0" | ||||||
|  |   resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.6.0.tgz#ce62fcb951faa6447cf47889f91efe3617b9eed2" | ||||||
|  |   integrity sha512-tjXrmAOFfVBfx+ZmgE5bkpDPs/euNj0xrUg8MowCWGfCRn01W679tTb+dyNeP6faxQTo2RcaD68xD8oLroJwwA== | ||||||
|  |   dependencies: | ||||||
|  |     "@sentry/hub" "6.6.0" | ||||||
|  |     "@sentry/minimal" "6.6.0" | ||||||
|  |     "@sentry/types" "6.6.0" | ||||||
|  |     "@sentry/utils" "6.6.0" | ||||||
|  |     tslib "^1.9.3" | ||||||
|  |  | ||||||
|  | "@sentry/types@6.6.0": | ||||||
|  |   version "6.6.0" | ||||||
|  |   resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.6.0.tgz#55cbca23859bad87411f0f32135a968e6e40a639" | ||||||
|  |   integrity sha512-lZ1uFN0lSNftAohi0lciEoSL58Gk/Ib1lLKaj0FSOvB1PAUmvo5dPtLdd0qjtNdtoaM8zqhrAbwCTQ8XZCDRsg== | ||||||
|  |  | ||||||
|  | "@sentry/utils@6.6.0": | ||||||
|  |   version "6.6.0" | ||||||
|  |   resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.6.0.tgz#b34d342d05eefc25b7ddd3f27f41c050f1e7e1ef" | ||||||
|  |   integrity sha512-FK9yqz2x+ef50B54tueeJ6mfb7Pf3lN75omx/YQBDL5cicyOV4j4kJDqn8/VKYhcSuX+ZaCZ/8bvOf0lxe0aHg== | ||||||
|  |   dependencies: | ||||||
|  |     "@sentry/types" "6.6.0" | ||||||
|  |     tslib "^1.9.3" | ||||||
|  |  | ||||||
| "@sindresorhus/is@^0.7.0": | "@sindresorhus/is@^0.7.0": | ||||||
|   version "0.7.0" |   version "0.7.0" | ||||||
|   resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd" |   resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd" | ||||||
| @@ -1221,6 +1289,13 @@ acorn@^7.4.0: | |||||||
|   resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" |   resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" | ||||||
|   integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== |   integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== | ||||||
|  |  | ||||||
|  | agent-base@6: | ||||||
|  |   version "6.0.2" | ||||||
|  |   resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" | ||||||
|  |   integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== | ||||||
|  |   dependencies: | ||||||
|  |     debug "4" | ||||||
|  |  | ||||||
| aggregate-error@^3.0.0: | aggregate-error@^3.0.0: | ||||||
|   version "3.1.0" |   version "3.1.0" | ||||||
|   resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" |   resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" | ||||||
| @@ -2285,6 +2360,11 @@ convert-source-map@^1.1.0, convert-source-map@^1.7.0: | |||||||
|   dependencies: |   dependencies: | ||||||
|     safe-buffer "~5.1.1" |     safe-buffer "~5.1.1" | ||||||
|  |  | ||||||
|  | cookie@^0.4.1: | ||||||
|  |   version "0.4.1" | ||||||
|  |   resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.1.tgz#afd713fe26ebd21ba95ceb61f9a8116e50a537d1" | ||||||
|  |   integrity sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA== | ||||||
|  |  | ||||||
| copy-descriptor@^0.1.0: | copy-descriptor@^0.1.0: | ||||||
|   version "0.1.1" |   version "0.1.1" | ||||||
|   resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" |   resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" | ||||||
| @@ -2456,6 +2536,13 @@ currently-unhandled@^0.4.1: | |||||||
|   dependencies: |   dependencies: | ||||||
|     array-find-index "^1.0.1" |     array-find-index "^1.0.1" | ||||||
|  |  | ||||||
|  | debug@4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: | ||||||
|  |   version "4.3.1" | ||||||
|  |   resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" | ||||||
|  |   integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== | ||||||
|  |   dependencies: | ||||||
|  |     ms "2.1.2" | ||||||
|  |  | ||||||
| debug@^2.2.0, debug@^2.3.3, debug@^2.6.9: | debug@^2.2.0, debug@^2.3.3, debug@^2.6.9: | ||||||
|   version "2.6.9" |   version "2.6.9" | ||||||
|   resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" |   resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" | ||||||
| @@ -2470,13 +2557,6 @@ debug@^3.2.7: | |||||||
|   dependencies: |   dependencies: | ||||||
|     ms "^2.1.1" |     ms "^2.1.1" | ||||||
|  |  | ||||||
| debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: |  | ||||||
|   version "4.3.1" |  | ||||||
|   resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" |  | ||||||
|   integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== |  | ||||||
|   dependencies: |  | ||||||
|     ms "2.1.2" |  | ||||||
|  |  | ||||||
| decamelize-keys@^1.1.0: | decamelize-keys@^1.1.0: | ||||||
|   version "1.1.0" |   version "1.1.0" | ||||||
|   resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9" |   resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9" | ||||||
| @@ -3920,6 +4000,14 @@ http-cache-semantics@3.8.1: | |||||||
|   resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz#39b0e16add9b605bf0a9ef3d9daaf4843b4cacd2" |   resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz#39b0e16add9b605bf0a9ef3d9daaf4843b4cacd2" | ||||||
|   integrity sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w== |   integrity sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w== | ||||||
|  |  | ||||||
|  | https-proxy-agent@^5.0.0: | ||||||
|  |   version "5.0.0" | ||||||
|  |   resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2" | ||||||
|  |   integrity sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA== | ||||||
|  |   dependencies: | ||||||
|  |     agent-base "6" | ||||||
|  |     debug "4" | ||||||
|  |  | ||||||
| hugo-extended@jakejarvis/hugo-extended#9f615221831632cb3b8879ab3fc420fff921e1fd: | hugo-extended@jakejarvis/hugo-extended#9f615221831632cb3b8879ab3fc420fff921e1fd: | ||||||
|   version "0.83.1" |   version "0.83.1" | ||||||
|   resolved "https://codeload.github.com/jakejarvis/hugo-extended/tar.gz/9f615221831632cb3b8879ab3fc420fff921e1fd" |   resolved "https://codeload.github.com/jakejarvis/hugo-extended/tar.gz/9f615221831632cb3b8879ab3fc420fff921e1fd" | ||||||
| @@ -4933,6 +5021,11 @@ lru-cache@^6.0.0: | |||||||
|   dependencies: |   dependencies: | ||||||
|     yallist "^4.0.0" |     yallist "^4.0.0" | ||||||
|  |  | ||||||
|  | lru_map@^0.3.3: | ||||||
|  |   version "0.3.3" | ||||||
|  |   resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.3.3.tgz#b5c8351b9464cbd750335a79650a0ec0e56118dd" | ||||||
|  |   integrity sha1-tcg1G5Rky9dQM1p5ZQoOwOVhGN0= | ||||||
|  |  | ||||||
| luxon@^1.27.0: | luxon@^1.27.0: | ||||||
|   version "1.27.0" |   version "1.27.0" | ||||||
|   resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.27.0.tgz#ae10c69113d85dab8f15f5e8390d0cbeddf4f00f" |   resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.27.0.tgz#ae10c69113d85dab8f15f5e8390d0cbeddf4f00f" | ||||||
| @@ -7373,7 +7466,7 @@ tsconfig-paths@^3.9.0: | |||||||
|     minimist "^1.2.0" |     minimist "^1.2.0" | ||||||
|     strip-bom "^3.0.0" |     strip-bom "^3.0.0" | ||||||
|  |  | ||||||
| tslib@^1.8.1, tslib@^1.9.0: | tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: | ||||||
|   version "1.14.1" |   version "1.14.1" | ||||||
|   resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" |   resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" | ||||||
|   integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== |   integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user