Skip to content

Commit 936df39

Browse files
committed
patch config files to add tags to events
1 parent 08100c2 commit 936df39

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

packages/nextjs/vercel/install-sentry-from-branch.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,33 @@ echo " "
3737
echo "MOVING BACK TO PROJECT DIRECTORY"
3838
cd $PROJECT_DIR
3939

40+
# TODO move this into `yarn vercel:project` script, accounting for differences in SDK repo location between running the
41+
# test app locally and on vercel
42+
echo " "
43+
echo "PATCHING SENTRY.SERVER.CONFIG.JS AND SENTRY.CLIENT.CONFIG.JS"
44+
echo "Removing frame limit on stacktraces"
45+
echo "Tagging events with $(vercel) tag"
46+
echo "Tagging events with SDK repo's most recent commit message"
47+
echo "Tagging events with test project repo's most recent commit message"
48+
49+
INFINITE_STACKTRACE_CODE="
50+
Error.stackTraceLimit = Infinity;
51+
"
52+
53+
SDK_COMMIT_MESSAGE=$(cd sentry-javascript && git log --format="%C(auto)%s" | head -n 1)
54+
CONFIGURE_SCOPE_CODE="
55+
Sentry.configureScope(scope => {
56+
if (process.env.VERCEL) {
57+
scope.setTag('vercel', true);
58+
}
59+
scope.setTag('commitMessage', process.env.VERCEL_GIT_COMMIT_MESSAGE);
60+
scope.setTag('sdkCommitMessage', \"$SDK_COMMIT_MESSAGE\");
61+
});
62+
"
63+
64+
echo "$INFINITE_STACKTRACE_CODE" "$CONFIGURE_SCOPE_CODE" >>sentry.server.config.js
65+
echo "$INFINITE_STACKTRACE_CODE" "$CONFIGURE_SCOPE_CODE" >>sentry.client.config.js
66+
4067
# Add built SDK as a file dependency. This has the side effect of forcing yarn to install all of the other dependencies,
4168
# saving us the trouble of needing to call `yarn` separately after this
4269
echo " "

0 commit comments

Comments
 (0)