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

[RN 0.50] Version doesn't get pushed, ls: "No installs recorded" #1072

Closed
fungilation opened this issue Nov 6, 2017 · 27 comments
Closed

[RN 0.50] Version doesn't get pushed, ls: "No installs recorded" #1072

fungilation opened this issue Nov 6, 2017 · 27 comments

Comments

@fungilation
Copy link

fungilation commented Nov 6, 2017

Steps to Reproduce

  1. Ran code-push release-react [APP] ios --outputDir ../[APP]-bundle -d Production
  2. Built app in Xcode, with native modules update that can't be pushed by CodePush
  3. Run app, quit and restart to get latest Code Pushed versions

Expected Behavior

Pushed code version gets deployed

Actual Behavior

"No installs recorded" on pushed version, after running code-push deployment ls [APP] and quit, restart app.

$ code-push deployment ls [APP]:
screenshot 2017-11-06 11 43 32

Error recorded on Sentry.io: https://sentry.io/share/issue/14c81f416a6c4a3899ee2950dc53aa1b/

Environment

  • react-native-code-push version: 5.1.3-beta
  • react-native version: 0.50.1
  • iOS/Android/Windows version: iOS
  • Does this reproduce on a debug build or release build? Release
  • Does this reproduce on a simulator, or only on a physical device? Physical

$ react-native info:

Environment:
  OS: macOS Sierra 10.12.6
  Node: 8.9.0
  Yarn: 1.3.2
  npm: 5.5.1
  Watchman: 4.9.0
  Xcode: Xcode 9.1 Build version 9B55
  Android Studio: Not Found

Packages: (wanted => installed)
  react: 16.0.0 => 16.0.0
  react-native: 0.50.1 => 0.50.1
@adbl
Copy link

adbl commented Nov 7, 2017

This probably facebook/react-native#16689

@fungilation
Copy link
Author

Metro Bundler fails again, probably.

@fungilation
Copy link
Author

Update: Got another Sentry error a few hours ago: https://sentry.io/share/issue/1d0884bb8de44f3998ff8e1fe32aa23c/

I just updated RN from 0.50.1 to 0.50.2, and added this to my package.json:

  "resolutions": {
    "metro-bundler": "0.20.1"
  }

This seems to have done the trick, with a new CodePush and restarting my app:
screenshot 2017-11-07 14 25 39

Commenting upstream on what appears to be a fix.

Thanks for the reference @adbl

@fungilation
Copy link
Author

Re-opening this as I'm again seeing similar "No installs recorded" on pushed version, after running code-push deployment ls [APP].

Previously 5.2.0-beta, upgrading to 5.2.1. On 5.2.0-beta, pushed versions get deployed as reported by code-push deployment ls. But not since upgrading to 5.2.1.

$ react-native info

Environment:
  OS: macOS Sierra 10.12.6
  Node: 8.9.1
  Yarn: 1.3.2
  npm: 5.5.1
  Watchman: 4.9.0
  Xcode: Xcode 9.2 Build version 9C40b
  Android Studio: Not Found

Packages: (wanted => installed)
  react: 16.0.0 => 16.0.0
  react-native: 0.50.4 => 0.50.4

@fungilation fungilation changed the title [RN 0.50] Version doesn't get pushed, error (Sentry): Can't find variable: record [RN 0.50] Version doesn't get pushed, ls: "No installs recorded" Dec 5, 2017
@ruslan-bikkinin
Copy link
Contributor

@fungilation please double check this is not metro-bundler/RN issue as it was before.

@fungilation
Copy link
Author

I'm pretty certain it's not, as strictly in terms of change management, I haven't touched RN itself with this change. And Metro related issues have been fixed in RN 0.50.

Before: RN-code-push 5.2.0-beta, versions pushed and verified as deployed based on code-push deployment ls.

After: RN-code-push 5.2.1, versions pushed not deployed. Same RN.

@ruslan-bikkinin
Copy link
Contributor

@fungilation could you please provide minimal version of your app so we could try to reproduce your issue? Please attach app logs too if you have it.

@fungilation
Copy link
Author

fungilation commented Dec 6, 2017

I'm not sure how I can quickly provide a minimal but still functional version of my app. How about an ejected skeleton from CRNA with my package.json?

{
  "name": "APP",
  "version": "0.0.1",
  "private": true,
  "eslintConfig": {
    "parserOptions": {
      "ecmaVersion": 6,
      "sourceType": "module",
      "ecmaFeatures": {
        "jsx": true,
        "experimentalObjectRestSpread": true
      }
    },
    "env": {
      "browser": true,
      "node": true
    },
    "plugins": [
      "react",
      "react-native"
    ],
    "rules": {
      "comma-dangle": [
        2,
        "always-multiline"
      ],
      "semi": [
        2,
        "never"
      ],
      "react-native/no-unused-styles": 2,
      "react-native/split-platform-components": 2
    }
  },
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start"
  },
  "dependencies": {
    "babel-plugin-idx": "^2",
    "he": "^1.1.0",
    "lodash": "^4.17.2",
    "moment": "^2.19.0",
    "moment-timezone": "^0.5.10",
    "node-summary": "../node-summary",
    "react": "16.0.0",
    "react-native": "0.50.4",
    "react-native-blur": "^3.2.0",
    "react-native-code-push": "5.2.0-beta",
    "react-native-firebase": "^3.0",
    "react-native-fit-image": "^1.4.8",
    "react-native-highlight-words": "smartkarma/react-native-highlight-words",
    "react-native-keep-awake": "^2.0.6",
    "react-native-linear-gradient": "^2.0.0",
    "react-native-modalbox": "^1.3.8",
    "react-native-notification": "../react-native-notification",
    "react-native-orientation": "^3.0.0",
    "react-native-parallax-scroll-view": "../react-native-parallax-scroll-view",
    "react-native-safari-view": "^2.0.0",
    "react-native-sentry": "^0.31",
    "react-native-sha256": "^1.1.1",
    "react-native-status-bar-size": "^0.3.2",
    "react-native-swiper": "^1.5.10",
    "react-native-tooltip": "../react-native-tooltip",
    "react-native-tts": "^1.3.0",
    "react-native-vector-icons": "^4.1.1",
    "react-native-webview-bridge": "../react-native-webview-bridge-RN0.40",
    "react-redux": "^5.0.1",
    "redux": "^3.6.0",
    "redux-thunk": "^2.1.0"
  },
  "devDependencies": {
    "redux-logger": "^3.0.6"
  },
  "resolutions": {
    "moment-timezone/moment": "^2.19.0"
  }
}

@fungilation
Copy link
Author

fungilation commented Dec 9, 2017

Update: Upgraded RN to 0.51.0 and tested a deploy. code-push deployment ls [APP] now also keep showing "No installs recorded" while react-native-code-push is kept on 5.2.0-beta.

I'm at a loss what broke code push with my install, and if it is specific to my install, how I would fix it. I'd try react-native unlink and link again, but that fails too: #1085

Or is this more systemic, if there's any other reports of deploy breakage while CodePush is being folded into App Center?

Suggestion appreciated on how I can "reset" my install or otherwise test why ls keeps showing "No installs recorded" from CodePush server?

@fungilation
Copy link
Author

Tried yarn remove and yarn add react-native-code-push in between the unlink and link as well, to no avail. react-native link react-native-code-push always ends with this:

? What is your CodePush deployment key for Android (hit <ENTER> to ignore) [KEY]
rnpm-install info Linking react-native-code-push android dependency 
rnpm-install info Android module react-native-code-push has been successfully linked 
rnpm-install info Linking react-native-code-push ios dependency 
rnpm-install ERR! Something went wrong while linking. Error: Cannot read property 'match' of undefined 
Please file an issue here: https://github.com/facebook/react-native/issues 

Cannot read property 'match' of undefined

Also tried deleting whole /node_modules/ directory and reinstall with yarn. With and without a react-native uninstall react-native-code-push first. react-native link after yarn packages rebuild still stalls at Cannot read property 'match' of undefined when linking react-native-code-push.

How do I do a complete unlink/uninstall and clean reinstall that may solve this linking issue? I want to see whether react-native-code-push is somehow broken in how it's linked in my app.

@fungilation
Copy link
Author

fungilation commented Dec 11, 2017

Tried debuging as per the doc, with

$ code-push debug ios
Listening for ios debug logs (Press CTRL+C to exit)

And that's all it tells me, no logs show up at all after the "Listening for" line, while my app is running in iOS (11.2) Simulator.

My CodePush integration code in index.js:

class APP extends Component {
  ...
}

APP = codePush({
  checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
  installMode: codePush.InstallMode.ON_NEXT_SUSPEND,
  // installMode: codePush.InstallMode.ON_NEXT_RESUME,
  minimumBackgroundDuration: 600,    // code-push deployment ls APP > Install Metrics should show N pending. To be installed after N seconds
})(APP)

Sentry.config("DSN").install()
// https://docs.sentry.io/clients/react-native/codepush/
codePush.getUpdateMetadata().then((update) => {
  if (update)
    Sentry.setVersion(update.appVersion + '-codepush:' + update.label)
})

AppRegistry.registerComponent('APP', () => APP)

No logs mean that libCodePush.a isn't working? I do see it linked in Xcode as lib. And I can't get it reinstalled and relinked as I've shown above, it always errors out at the rnpm-install ERR! Something went wrong while linking. Error: Cannot read property 'match' of undefined on link. After that, libCodePush.a disappears from my project.pbxproj.

@ruslan-bikkinin
Copy link
Contributor

Hi @fungilation, sorry for delay, unfortunately, I have another priorities for now, but don't worry I will be back soon and we will continue discussion.

@ruslan-bikkinin
Copy link
Contributor

@fungilation please try to re-install CodePush for your app:

  1. Uninstall CodePush using these instrustions
  2. Install CodePush using manual steps instead of react-native link.

@fungilation
Copy link
Author

fungilation commented Dec 12, 2017

Ok. Gone through every step of uninstalling and reinstalling/linking manually. Same thing.

Along the way, I even found and fixed a side issue. This is in my index.js:

APP = codePush({
    deploymentKey: '[KEY]',   // can't rely on CodePushDeploymentKey: $(CODEPUSH_KEY) in Info.plist?
    checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
    installMode: codePush.InstallMode.ON_NEXT_SUSPEND,   // https://github.com/Microsoft/react-native-code-push/pull/770
    // installMode: codePush.InstallMode.ON_NEXT_RESUME,    // https://github.com/Microsoft/react-native-code-push/blob/master/docs/api-js.md#installmode
    minimumBackgroundDuration: 600,    // code-push deployment ls APP > Install Metrics should show N pending. To be installed after N seconds
  })(APP)

where I didn't specify deploymentKey at run time before, as I relied on key from Xcode config. In my Info.plist:

<key>CodePushDeploymentKey</key>
<string>$(CODEPUSH_KEY)</string>

and I have CODEPUSH_KEY as 2 variables in Xcode production and staging build configs. This was all working before. But now Chrome DevTools console attached to my app in simulator now tells me it was missing a key, so I additionally set it in index.js as shown above. Chrome console now returns on app launch:

[CodePush] Checking for update.
[CodePush] Downloading package.

BUT, hoping for the best with actual code pushed in production, with a code-push release-react APP ios ..., then starting and restarting my Xcode built app on device. No new version gets deployed still and code-push deployment ls APP still shows under the Install Metrics column, "No installs recorded".

I'm out of ideas. Anything else I can debug or test?

@ruslan-bikkinin
Copy link
Contributor

@fungilation could you please share with me the output of code-push app ls and appcenter apps list (please install appcenter cli with npm i -g appcenter-cli)?

@fungilation
Copy link
Author

$ code-push app ls
┌─────────────┬─────────────────────┐
│ Name        │ Deployments         │
├─────────────┼─────────────────────┤
│ WonderSwipe │ Production, Staging │
└─────────────┴─────────────────────┘
$ appcenter apps list
* gfung/WonderSwipe (current app)

And from https://appcenter.ms/ dashboard, deploys were working up to last version at v231 on Dec. 4, about a week ago. Please tell me my hair pulling isn't just me and this is something server-side, maybe related to migration to App Center 😭

screenshot 2017-12-12 02 03 52

@ruslan-bikkinin
Copy link
Contributor

ruslan-bikkinin commented Dec 12, 2017

@fungilation Its looks strange, I believe we should investigate this on our side. Yeah, probably, this issue somehow related with migration to appcenter. @fungilation could you please confirm that switching to code-push release-react gfung/WonderSwipe solves your problem? I mean after executing this command and installing update on device install metrics begins to appear?

@fungilation
Copy link
Author

fungilation commented Dec 12, 2017

Umm,

$ code-push release-react gfung/WonderSwipe
Usage: code-push release-react <appName> <platform> [options]

Or did you mean: (gfung/WonderSwipe is the current app selected in appcenter)

$ appcenter codepush release-react -d Production
Detecting ios app version:

Using the target binary version value "1.0.1" from "ios/wonderswipe/Info.plist".

Running "react-native bundle" command:

node node_modules/react-native/local-cli/cli.js bundle --assets-dest /var/folders/q2/nn87n125621g5t3h_n_nx4vw0000gn/T/code-push1171112-53420-19imw5v.21n8 --bundle-output /var/folders/q2/nn87n125621g5t3h_n_nx4vw0000gn/T/code-push1171112-53420-19imw5v.21n8/main.jsbundle --dev false --entry-file index.js --platform ios
Scanning folders for symlinks in /Users/garyfung/Documents/code/WonderSwipe/node_modules (23ms)
Scanning folders for symlinks in /Users/garyfung/Documents/code/WonderSwipe/node_modules (15ms)
Loading dependency graph, done.

bundle: start
bundle: finish
bundle: Writing bundle output to: /var/folders/q2/nn87n125621g5t3h_n_nx4vw0000gn/T/code-push1171112-53420-19imw5v.21n8/main.jsbundle
bundle: Copying 1 asset files
bundle: Done writing bundle output
bundle: Done copying assets

Releasing update contents to CodePush:

Successfully released an update containing the "/var/folders/q2/nn87n125621g5t3h_n_nx4vw0000gn/T/code-push1171112-53420-19imw5v.21n8" directory to the "Production" deployment of the "WonderSwipe" app.

So I did that. After, I rebuilt app in Xcode. Some relevant Xcode logs that has "codepush" in the lines, while my app is running on device in Production mode and attached to Xcode:

2017-12-12 11:32:59.192725-0800 wonderswipe[7833:2776259] [Accessibility] ****************** Loading GAX Client Bundle ****************
2017-12-12 11:33:05.021621-0800 wonderswipe[7833:2776259] 
[CodePush] Loading JS bundle from file:///var/containers/Bundle/Application/9137FF1E-62E3-4C22-B117-150D5D46BF05/wonderswipe.app/main.jsbundle
2017-12-12 11:33:05.022 [info][tid:main][RCTCxxBridge.mm:213] Initializing <RCTCxxBridge: 0x1d01cf5a0> (parent: <RCTBridge: 0x1d00c0cb0>, executor: (null))
...
2017-12-12 11:33:08.008205-0800 wonderswipe[7833:2776259] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
2017-12-12 11:33:08.131089-0800 wonderswipe[7833:2776259] [MC] Lazy loading NSBundle MobileCoreServices.framework
2017-12-12 11:33:08.131169-0800 wonderswipe[7833:2776259] [MC] Loaded MobileCoreServices.framework
2017-12-12 11:33:08.169 [info][tid:com.facebook.react.JavaScript] [CodePush] Checking for update.
2017-12-12 11:33:08.169253-0800 wonderswipe[7833:2776576] [CodePush] Checking for update.
2017-12-12 11:33:09.710 [info][tid:com.facebook.react.JavaScript] [CodePush] Downloading package.
2017-12-12 11:33:09.709896-0800 wonderswipe[7833:2776576] [CodePush] Downloading package.
2017-12-12 11:33:12.377086-0800 wonderswipe[7833:2776566] WF: === Starting WebFilter logging for process wonderswipe

Then I detached app from Xcode and restarted it. Checking code-push deployment ls WonderSwipe and https://appcenter.ms/, same thing. No installs or downloads recorded on server, "No installs recorded".

@ruslan-bikkinin
Copy link
Contributor

@fungilation could you please add download progress logs to your app like this:

sync() {
    CodePush.sync(
      { /* your options */},
      (progress) => {
       console.log(progress.receivedBytes + " of " + progress.totalBytes + " received.")
      }
    );
  }

and share these logs with us?

@ovaris
Copy link

ovaris commented Dec 13, 2017

I think I have the same problem, after migrating to appcenter (and moving app under new organization), last thing I see in iOS log is:

[CodePush] Checking for update.
2017-12-13 16:33:21.157 [info][tid:com.facebook.react.JavaScript] [CodePush] Awaiting user action.
2017-12-13 16:33:21.160993+0200 xxx[95954:3612489] [CodePush] Awaiting user action.
2017-12-13 16:33:27.463 [info][tid:com.facebook.react.JavaScript] [CodePush] Downloading package.
2017-12-13 16:33:27.464112+0200 xxx[95954:3612489] [CodePush] Downloading package.

Using RN 51.0 and react-native-code-push: 5.2.1

@fungilation
Copy link
Author

@ruslan-bikkinin This is console logs I'm getting:

10:36:37.656 console.js:32 [CodePush] Sync already in progress.
10:36:38.255 console.js:32 [CodePush] undefined of undefined received.
10:36:39.151 console.js:32 [CodePush] undefined of undefined received.

Please check if I've integrated your code correctly, since I used to specify options in codePush({options})(root_component), not options in a separate .sync call before or after that.

class WonderSwipe extends Component {
  ...
}

  codePush.sync({
      deploymentKey: '[KEY]',   // can't rely on CodePushDeploymentKey: $(CODEPUSH_KEY) in Info.plist?
      checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
      installMode: codePush.InstallMode.ON_NEXT_SUSPEND,   // https://github.com/Microsoft/react-native-code-push/pull/770
      // installMode: codePush.InstallMode.ON_NEXT_RESUME,    // https://github.com/Microsoft/react-native-code-push/blob/master/docs/api-js.md#installmode
      minimumBackgroundDuration: 600,    // code-push deployment ls WonderSwipe > Install Metrics should show N pending. To be installed after N seconds
    },
    (progress) => {
      console.log("[CodePush]", progress.receivedBytes + " of " + progress.totalBytes + " received.")
    }
  )
  WonderSwipe = codePush()(WonderSwipe)

@fungilation
Copy link
Author

And in case you are wondering, I have in Info.plist:

	<key>NSAppTransportSecurity</key>
	<dict>
		<key>NSAllowsArbitraryLoads</key>
		<true/>
	</dict>

@fungilation
Copy link
Author

@ruslan-bikkinin any status update would be much appreciated, like whether you think it really is a server side issue or you need more time to investigate? I just want to decide whether I should hold off my app releases or not while CodePush is broken. Much appreciated

@ruslan-bikkinin
Copy link
Contributor

Hi again @fungilation and sorry for the delayed response - currently we are under-resourced and have to take care of other things in terms of appcenter and codepush. As for your case, I’ve tried to reproduce it, but with no luck, so could you please share with me the minimum version of your app where the issue reproduces? (package.json is not enough due to we also need js code to reproduce the issue). You also can email me at v-rubikk@microsoft.com and share the full working version of your app so I can try to investigate it, but again - the minimum working version of you the code with minimum repro steps is the best choice for us because we’ll be able to determine the root cause of the issue much faster.

I’ve also notice that you are using --outputDir parameter, could you please try to release an update without it? Just to make sure that your issue does not relate to this one somehow microsoft/code-push#545

@ovaris
Copy link

ovaris commented Dec 18, 2017

The issue was somehow fixed by itself for us, so latest code-push release using appcenter cli worked just fine.

@fungilation
Copy link
Author

fungilation commented Dec 19, 2017

Hallelujah!
screenshot 2017-12-18 16 31 33

This after upgrading other packages I have (moment, react-native-firebase, react-native-sentry), and as part of upgrades I nuked the ios/Pods directory and rebuilt it. And after rebuilding app in Xcode, it just started working with this in Xcode logs:

[CodePush] Loading JS bundle from file:///var/containers/Bundle/Application/DBB97322-3648-4D92-AE6A-D87B49DDF1D8/wonderswipe.app/main.jsbundle
...
2017-12-18 16:22:08.718137-0800 wonderswipe[8885:2912327] [MC] Lazy loading NSBundle MobileCoreServices.framework
2017-12-18 16:22:08.718205-0800 wonderswipe[8885:2912327] [MC] Loaded MobileCoreServices.framework
2017-12-18 16:22:08.778 [info][tid:com.facebook.react.JavaScript] [CodePush] Sync already in progress.
2017-12-18 16:22:08.777925-0800 wonderswipe[8885:2912479] [CodePush] Sync already in progress.
2017-12-18 16:22:11.025 [warn][tid:com.facebook.react.CodePushQueue][RCTEventEmitter.m:54] Sending `CodePushDownloadProgress` with no listeners registered.
2017-12-18 16:22:11.025619-0800 wonderswipe[8885:2912486] Sending `CodePushDownloadProgress` with no listeners registered.
2017-12-18 16:22:11.062185-0800 wonderswipe[8885:2912474] WF: === Starting WebFilter logging for process wonderswipe
2017-12-18 16:22:11.062231-0800 wonderswipe[8885:2912474] WF: _userSettingsForUser mobile: {
    filterBlacklist =     (
    );
    filterWhitelist =     (
    );
    restrictWeb = 1;
    useContentFilter = 0;
    useContentFilterOverrides = 0;
    whitelistEnabled = 0;
}
2017-12-18 16:22:11.062280-0800 wonderswipe[8885:2912474] WF: _WebFilterIsActive returning: NO
2017-12-18 16:22:11.065051-0800 wonderswipe[8885:2912483] 
[CodePush] Applying full update.

Emphasis on the last line: [CodePush] Applying full update. when before, Xcode logs would end on a [CodePush] Downloading package. line without further logs filtered on [CodePush].

Tested with deploys via both forms:
appcenter codepush release-react -d Production
and
code-push release-react WonderSwipe ios --outputDir ../WonderSwipe-bundle -d Production --des ""

Considering the timing of both @ovaris and I having pushed versions downloading/applying in our apps again today. A confirmation from Microsoft that this has been a server issue and is now fixed would be great?

@sergey-akhalkov
Copy link
Contributor

Hi @fungilation, @ovaris, thanks for reaching us and sorry for the inconvenience. The issue looks really weird (especially in the fact that it does not reproduce for us and that it has been resolved by itself). Also we haven't seen it before.

As for now - please update your code-push-cli due to it contains a bugfix that may affect not only users who are using code-signing (this fix has not been merged for appcenter-cli yet). Probably the issue can somehow relate to this one microsoft/code-push#547 - we are working on it.

Please let us know if it will happen again, so I'm closing this for now.

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

No branches or pull requests

5 participants