Skip to content

Commit

Permalink
Merge pull request #476 from desci-labs/sentry-update
Browse files Browse the repository at this point in the history
sentry update
  • Loading branch information
hubsmoke authored Sep 27, 2024
2 parents 5313c5b + ddc7532 commit f20e5c0
Show file tree
Hide file tree
Showing 7 changed files with 504 additions and 20 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ env:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CONTAINER_IMAGE: desci-server
DOCKER_BUILDKIT: 1
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

jobs:
build-and-test:
Expand Down Expand Up @@ -55,6 +56,15 @@ jobs:
echo "{\"proxies\":[{\"address\":\"\"}]}" > desci-server/src/desci-contracts-config/unknown-research-object.json
echo "{\"proxies\":[{\"address\":\"\"}]}" > desci-server/src/desci-contracts-config/unknown-dpid.json
- name: Set up Sentry CLI
run: |
npm install -g @sentry/cli
sentry-cli --version
sentry-cli login --auth-token $SENTRY_AUTH_TOKEN
# append to .env
echo -e "\nSENTRY_AUTH_TOKEN=$SENTRY_AUTH" >> desci-server/.env
cd desci-server && yarn build
- name: Run tests
run: |
cd desci-server && export DOCKER_BUILDKIT=1 && yarn --ignore-engines && yarn test
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/build-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
CONTAINER_IMAGE: desci-server
DOCKER_BUILDKIT: 1

Expand Down Expand Up @@ -57,6 +58,10 @@ jobs:
echo "{\"proxies\":[{\"address\":\"\"}]}" > desci-server/src/desci-contracts-config/unknown-research-object.json
echo "{\"proxies\":[{\"address\":\"\"}]}" > desci-server/src/desci-contracts-config/unknown-dpid.json
- name: Set up Sentry CLI
run: |
sentry-cli --version
- name: Run tests
run: |
cd desci-server && export DOCKER_BUILDKIT=1 && yarn --ignore-engines && yarn test
Expand Down Expand Up @@ -113,6 +118,11 @@ jobs:
echo "{\"proxies\":[{\"address\":\"\"}]}" > desci-server/src/desci-contracts-config/unknown-research-object.json
echo "{\"proxies\":[{\"address\":\"\"}]}" > desci-server/src/desci-contracts-config/unknown-dpid.json
- name: Set up Sentry CLI
run: |
sentry-cli --version
sentry-cli login --auth-token $SENTRY_AUTH_TOKEN
- name: Build and tag the image (DEV)
if: github.ref == 'refs/heads/develop'
run: |
Expand Down
3 changes: 3 additions & 0 deletions desci-server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ server.log
repo-tmp

queries.sql

# Sentry Config File
.sentryclirc
8 changes: 5 additions & 3 deletions desci-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"script:seed-social-data": "debug=* node --no-warnings --enable-source-maps --loader ts-node/esm ./src/scripts/seed-social-data.ts",
"script:DESTRUCTIVE-clear-social-data": "debug=* node --no-warnings --enable-source-maps --loader ts-node/esm ./src/scripts/DESTRUCTIVE-clear-social-data.ts",
"script:seed-community-member": "debug=* node --no-warnings --enable-source-maps --loader ts-node/esm ./src/scripts/seed-community-members.ts",
"build": "rimraf dist && tsc && yarn copy-files",
"build": "rimraf dist && tsc && yarn copy-files; if [ \"$SENTRY_AUTH_TOKEN\" ]; then yarn sentry:sourcemaps; else echo 'SENTRY_AUTH_TOKEN not set, sourcemaps will not upload'; fi",
"copy-files": "copyfiles -u 1 src/**/*.cjs dist/",
"generate": "npx prisma generate",
"migrate:local": "DATABASE_URL=postgresql://walter:white@localhost:5433/boilerplate npx prisma migrate dev",
Expand All @@ -50,7 +50,8 @@
"docker:prod": "../dockerProd.sh",
"podman:dev": "podman-compose --file docker-compose.yml --file docker-compose.dev.yml up --build",
"email-dev": "email dev --dir ./src/templates/emails --port 3777",
"check-deps": "npx npm-check"
"check-deps": "npx npm-check",
"sentry:sourcemaps": "sentry-cli sourcemaps inject --org desci-labs --project nodes-backend ./dist && sentry-cli sourcemaps upload --org desci-labs --project nodes-backend ./dist && echo 'Sentry sourcemaps uploaded'"
},
"dependencies": {
"@automerge/automerge-repo": "^1.0.19",
Expand All @@ -68,7 +69,8 @@
"@prisma/client": "4.10.1",
"@react-email/components": "0.0.15",
"@sendgrid/mail": "^7.7.0",
"@sentry/node": "^7.12.0",
"@sentry/cli": "^2.35.0",
"@sentry/node": "^8.29.0",
"@sentry/tracing": "^7.12.0",
"@types/lodash-es": "^4.17.12",
"@types/mkdirp": "^1.0.2",
Expand Down
4 changes: 1 addition & 3 deletions desci-server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,7 @@ class AppServer {
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
});
this.app.use(Sentry.Handlers.requestHandler());
this.app.use(Sentry.Handlers.tracingHandler());
this.app.use(Sentry.Handlers.errorHandler());
Sentry.setupExpressErrorHandler(this.app);
} else {
logger.info('[DeSci Nodes] Telemetry disabled');
}
Expand Down
14 changes: 12 additions & 2 deletions desci-server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// "verbatimModuleSyntax": true,

"lib": ["esnext", "dom"],

"outDir": "./dist",
"removeComments": true,
"emitDecoratorMetadata": true,
Expand All @@ -21,14 +22,23 @@
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,

// dagConcat.cjs requires this
"allowJs": true,
"inlineSourceMap": true,

"paths": {
// Overrides a built-in Response type
"express": ["./src/types/express"]
},
"jsx": "react"

"jsx": "react",
"sourceMap": true,
"inlineSources": true,

// Set `sourceRoot` to "/" to strip the build path prefix
// from generated source code references.
// This improves issue grouping in Sentry.
"sourceRoot": "/"
},
"include": ["./src/**/*.tsx", "./src/**/*.ts", "./src/**/*.cjs", "src/utils/dagConcat.ts"],
"exclude": ["test/**/*.ts"],
Expand Down
Loading

0 comments on commit f20e5c0

Please sign in to comment.