Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(expo): Added ability to provide sentryUrl for source maps upload #3664

Closed
wants to merge 6 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions scripts/expo-upload-sourcemaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const fs = require('fs');
const path = require('path');
const process = require('process');

const SENTRY_URL = 'SENTRY_URL';
const SENTRY_ORG = 'SENTRY_ORG';
const SENTRY_PROJECT = 'SENTRY_PROJECT';
const SENTRY_AUTH_TOKEN = 'SENTRY_AUTH_TOKEN';
Expand Down Expand Up @@ -111,6 +112,7 @@ try {
}

let sentryOrg = getEnvVar(SENTRY_ORG);
let sentryUrl = getEnvVar(SENTRY_URL);
let sentryProject = getEnvVar(SENTRY_PROJECT);
let authToken = getEnvVar(SENTRY_AUTH_TOKEN);
const sentryCliBin = getEnvVar(SENTRY_CLI_EXECUTABLE) || require.resolve('@sentry/cli/bin/sentry-cli');
Expand Down Expand Up @@ -147,6 +149,13 @@ if (!sentryOrg || !sentryProject) {
console.log(`${SENTRY_PROJECT} resolved to ${sentryProject} from expo config.`);
}
}
if (pluginConfig.url) {
sentryUrl = pluginConfig.url;
} else {
sentryUrl
}
console.log(`${SENTRY_PROJECT} resolved to ${sentryProject} from expo config.`);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although, I agree with loading the URL from the Expo Plugin Configuration.

The current code won't work, as pluginConfig variable is not in the scope.

This should be under if (!sentryOrg || !sentryProject) {, which needs to be updated to include sentryUrl.


if (!authToken) {
console.error(`${SENTRY_AUTH_TOKEN} environment variable must be set.`);
Expand Down Expand Up @@ -186,6 +195,7 @@ for (const [assetGroupName, assets] of Object.entries(groupedAssets)) {
...process.env,
[SENTRY_PROJECT]: sentryProject,
[SENTRY_ORG]: sentryOrg,
[SENTRY_URL]: sentryUrl
},
stdio: 'inherit',
});
Expand All @@ -196,8 +206,7 @@ if (numAssetsUploaded === totalAssets) {
console.log('✅ Uploaded bundles and sourcemaps to Sentry successfully.');
} else {
console.warn(
`⚠️ Uploaded ${numAssetsUploaded} of ${totalAssets} bundles and sourcemaps. ${
numAssetsUploaded === 0 ? 'Ensure you are running `expo export` with the `--dump-sourcemap` flag.' : ''
`⚠️ Uploaded ${numAssetsUploaded} of ${totalAssets} bundles and sourcemaps. ${numAssetsUploaded === 0 ? 'Ensure you are running `expo export` with the `--dump-sourcemap` flag.' : ''
krystofwoldrich marked this conversation as resolved.
Show resolved Hide resolved
krystofwoldrich marked this conversation as resolved.
Show resolved Hide resolved
}`,
);
}
Loading