Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Instabug source map upload returns 500 Internal Server Error #1393

Closed
@naveen-pf

Description

@naveen-pf

Hi Instabug team,

I'm trying to upload source maps for React Native using your https://api.instabug.com/api/sdk/v3/symbols_files endpoint.

Here’s the relevant part of my code that generates the sourcemap and uploads it via curl:

`const {execSync} = require('child_process');
const {getConfig} = require('@expo/config');
const path = require('path');

const {exp} = getConfig(process.cwd());
const args = process.argv.slice(2);

const channel = args.includes('--channel')
? args[args.indexOf('--channel') + 1]
: 'staging';

const platformList = ['ios', 'android'];

const appVersion = process.env.APP_VERSION || '1.0.0';
const buildNumber = process.env.BUILD_NUMBER || '10001';
const environment = channel === 'production' ? 'production' : 'staging';
const instabugToken =
channel === 'production'
? exp.extra.instabugKeys.Production
: exp.extra.instabugKeys.Staging;

const codePushVersion = execSync('git rev-parse --short HEAD')
.toString()
.trim();

console.log(📦 App Version: ${appVersion});
console.log(📦 Build Number: ${buildNumber});
console.log(📦 Environment: ${environment});
console.log(📦 CodePush Version: ${codePushVersion});
console.log(📦 Instabug Token: ${instabugToken});
console.log(📦 Channel: ${channel});

console.log(🔁 Running EAS Update for channel: ${channel}...);
// execSync(npx eas update --channel ${channel} --non-interactive --message "OTA Update for ${channel}", {
// stdio: 'inherit',
// });

console.log('📦 Bundling and uploading source maps for Instabug...');

platformList.forEach((platform) => {
const bundleDir = ./dist/bundles/${platform};
const entryFile = 'index.js';
const sourcemapPath = path.resolve(${bundleDir}/${platform}-sourcemap.json);
const bundlePath = path.resolve(${bundleDir}/index.${platform}.bundle);

// Step 1: Bundle the app
execSync(
npx react-native bundle \ --entry-file ${entryFile} \ --platform ${platform} \ --dev false \ --bundle-output ${bundlePath} \ --sourcemap-output ${sourcemapPath} \ --assets-dest ${bundleDir},
{stdio: 'inherit'},
);

// Step 2: Upload using curl
const versionJson = JSON.stringify({
name: appVersion,
code: buildNumber,
codepush: codePushVersion,
});

const curlCommand = curl --trace-ascii ./instabug-curl.log --fail-with-body -X POST https://api.instabug.com/api/sdk/v3/symbols_files \ -F "symbols_file=@${sourcemapPath}" \ -F "application_token=${instabugToken}" \ -F "platform=react_native" \ -F "os=${platform}" \ -F "app_version=${versionJson}";

console.log(📤 Uploading source map for ${platform}...);
execSync(curlCommand, {stdio: 'inherit'});

console.log(✅ Source map uploaded for ${platform} platform.);
});
`

❌ Problem
The API returns:

{"status":500,"error":"Internal Server Error"}

Even though the sourcemap and bundle are valid files, and the upload appears to succeed (no curl error).

I’ve already added --trace-ascii to get internal curl logs, but the response body is not helpful beyond the 500.

Can you help identify what could be wrong or validate whether the app_version format or file MIME type could be causing the 500?

Thanks!
Naveen

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions