-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
I wrote a plugin for uploading sourcemaps. It works properly on the iOS side but not on the Android side, and I’m having difficulty pinpointing the exact issue.
Steps to reproduce
"expo": "~52.0.18",
"react": "18.3.1",
"react-native": "0.76.5",
"rollbar": "2.26.4",
"rollbar-react-native": "1.0.0-beta.5",
Platforms
Android
JavaScript runtime
Hermes
Workflow
Expo
Build type
Release mode
Device
Real device
i uploaded the sourcemap
const uploadSourceMaps = async () => {
const bundle = `${PROJECT_ROOT}/android/app/build/generated/assets/createBundleReleaseJsAndAssets/index.android.bundle`
await access(bundle).catch((error) => {
console.log(
`Skipping Android source map upload: App bundle ${bundle} could not be found.\n${error}`
)
exit(0)
})
const sourceMap = `${PROJECT_ROOT}/android/app/build/generated/sourcemaps/react/release/index.android.bundle.map`
await access(sourceMap).catch((error) => {
console.error(
`Error: source map ${sourceMap} could not be found.\n${error}`
)
exit(1)
})
let access_token = process.env.NEXT_PUBLIC_ROLLBAR_SERVER_TOKEN
if (!access_token) {
console.error("Error: No API key detected in app config")
exit(1)
}
console.log("Uploading Android source map to Rollbar...")
let appConfig, appVersion
try {
appConfig = getConfig(PROJECT_ROOT)
appVersion = appConfig?.exp?.extra?.appVersion
} catch (error) {
console.error(
`Error: Failed to read app config in ${PROJECT_ROOT}.\n${error}`
)
exit(1)
}
const bunldeNumber =
process.env.NEXT_PUBLIC_NODE_ENV === "prod"
? ""
: `.${process.env.EAS_BUILD_ANDROID_VERSION_CODE}`
const version = `${appVersion}${bunldeNumber}`
const minifiedUrl = `http://reactnativehost/${bundle}`
const curlCommand = `curl https://api.rollbar.com/api/1/sourcemap \
-F access_token="${access_token}" \
-F version="${version}" \
-F minified_url="${minifiedUrl}" \
-F source_map=@"${sourceMap}"`
exec(curlCommand, (error, stdout, stderr) => {
if (error) {
console.error(`Error uploading source map: ${error.message}`)
console.error(stderr)
exit(1)
}
console.log("Source map uploaded successfully!")
console.log(stdout)
exit(0)
})
}
I don’t understand why the path is http://reactnativehost/address at /data/user/0/com.passesstaging.app/files/.expo-internal/bundle-72b51cdd-b552-4ca3-9963-86b52b77e396.js:1:748115 instead of index.android.bundle.
below is config:
new Client({
accessToken: process.env.NEXT_PUBLIC_ROLLBAR_CLIENT_TOKEN,
captureUncaught: true,
captureUnhandledRejections: true,
enabled: isDevice && !isDev,
payload: {
environment: isProd ? "prod" : "stage",
client: {
javascript: {
source_map_enabled: !isDev,
code_version:
Application.nativeApplicationVersion +
(isProd ? "" : `.${Application.nativeBuildVersion}`),
guess_uncaught_frames: true,
rewriteFilenamePatterns: [
Platform.OS === "ios" ? "([^/]*)$" : "^address at (.*)$"
]
}
}
}
}).rollbar
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

