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

postPublish not running in sdk 47 causing the source maps to not upload #306

Closed
lemontron opened this issue Dec 1, 2022 · 6 comments
Closed
Labels

Comments

@lemontron
Copy link

Summary

I followed the guide to install sentry-expo which resulted in sentry-expo 5.0.0 being installed. I already fixed this myself by updating manually to "sentry-expo": "6.0.0"

If I run eas update an OTA is published successfully and the client receives the update however the source maps are missing from sentry. To debug, I add a console.log('HERE123') to upload-sourcemaps.js I noticed that HERE123 does not show when running eas update.

I have postPublish and plugins declared in app.json

    "plugins": [
      "sentry-expo"
    ],
      "postPublish": [
        {
          "file": "sentry-expo/upload-sourcemaps",
          "config": {
            "organization": "<secret>",
            "project": "<secret>",
            "authToken": "<secret>"
          }
        }
      ]

the result? postPublish script is not being called!

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

bare

What platform(s) does this occur on?

iOS

SDK Version (managed workflow only)

47

Environment

expo-env-info 1.0.5 environment info:
    System:
      OS: macOS 13.0.1
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 14.21.1 - /opt/homebrew/opt/node@14/bin/node
      Yarn: 1.22.19 - ~/.yarn/bin/yarn
      npm: 6.14.17 - /opt/homebrew/opt/node@14/bin/npm
      Watchman: 2022.11.07.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
    IDEs:
      Android Studio: 2021.1 AI-211.7628.21.2111.8193401
      Xcode: 14.1/14B47b - /usr/bin/xcodebuild
    npmPackages:
      expo: ^47.0.0 => 47.0.8 
      react: 18.2.0 => 18.2.0 
      react-native: 0.70.6 => 0.70.6 
    npmGlobalPackages:
      eas-cli: 2.8.0
      expo-cli: 6.0.8
    Expo Workflow: bare

Reproducible demo or steps to reproduce from a blank project

https://docs.expo.dev/guides/using-sentry/

@Norfeldt
Copy link

Norfeldt commented Dec 8, 2022

Think this is related. I'm on sdk 46 (using "@sentry/react-native": "4.2.2" and "sentry-expo": "~5.0.0") and experiencing that sometimes it does not upload the source map, which is a problem since it creates a new archive with the same release name.

Screenshot 2022-12-08 at 13 24 57

It seems like its the android postPublish hook that is causing it. So it also might be related to #292

@krystofwoldrich
Copy link
Contributor

For OTA updates you need to upload the bundle and the source maps manually.

https://docs.expo.dev/guides/using-sentry/#uploading-sourcemaps-for-updates

Maybe this repo (managed workflow) can also help with finding the bug.
https://github.com/krystofwoldrich/sentry-expo-sample-app

@lemontron
Copy link
Author

are we expected to do stuff like this to hack it to work?

import inquirer from 'inquirer';
import { createRequire } from 'module';
import { execa } from 'execa';
import fs from 'fs';

const require = createRequire(import.meta.url); // song and dance

const {BASE_DOMAIN, RELEASE_CHANNEL} = require('./constants/config.json');

inquirer.prompt([{
	name: 'confirm',
	message: 'Are you sure you want to deploy to this config? \n' +
		`BASE_DOMAIN: ${BASE_DOMAIN}\n` +
		`RELEASE_CHANNEL: ${RELEASE_CHANNEL}`,
	type: 'confirm',
}]).then(async answers => {
	if (!answers.confirm) return console.log('Cancelled! Bye!');

	await execa('watchman', ['watch-del ./']);
	await execa('watchman', ['watch-project ./']);

	const eas = await execa('eas', ['update', '--auto', '--branch', RELEASE_CHANNEL]);

	console.log(eas.stdout);

	const iosUpdateId = eas.stdout.split('\n').find(s => s.startsWith('iOS update ID')).split(' ').pop();
	const bundles = fs.readdirSync('dist/bundles');
	const iosBundle = bundles.find(s => s.startsWith('ios-') && s.endsWith('.js'));
	const iosMap = bundles.find(s => s.startsWith('ios-') && s.endsWith('.map'));
	fs.renameSync(`dist/bundles/${iosBundle}`, 'dist/bundles/main.jsbundle');

	const sentry = await execa('node_modules/@sentry/cli/bin/sentry-cli', [
		'releases',
		'--org', 'hotspot-app',
		'files', `com.hux.hotspot@staging`,
		'upload-sourcemaps',
		'--dist', iosUpdateId,
		'--rewrite',
		`dist/bundles/main.jsbundle`, `dist/bundles/${iosMap}`,
	], {
		env: {
			'SENTRY_PROJECT': 'hotspot',
		},
	});
	console.log(sentry);
});

@krystofwoldrich
Copy link
Contributor

Based on the docs I believe you are right @jamesloper if you want to automatize the process.

Disclaimer, I maintain the @sentry/react-native, so when it comes to sentry-expo my knowledge is limited.

@github-actions
Copy link

github-actions bot commented Mar 8, 2023

This issue is stale because it has been open for 60 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

@github-actions github-actions bot added the stale label Mar 8, 2023
@github-actions
Copy link

This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants