React-native-permissions: Intermittent 'Error: The operation couldn鈥檛 be completed. (CMErrorDomain error 103.)' error

Created on 7 Jan 2020  路  6Comments  路  Source: zoontek/react-native-permissions

Bug

Error: The operation couldn鈥檛 be completed. (CMErrorDomain error 103.)
  File "app:///876.js", line 1, col 3019
    {snip} tform.OS){f.next=4;break}return f.abrupt("return",l.request(t));case 4:return f.next=6,u.default.awrap(l.isAvailable(t));case 6:if(f.sent){f {snip}
  File "app:///235.js", line 1, col 423, in p
    {snip} ,f),h}function p(t,n,o){try{return{type:"normal",arg:t.call(n,o)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var y="suspendedStart",v="su {snip}
  File "app:///235.js", line 1, col 1740
    {snip} se"return"===o.method&&o.abrupt("return",o.arg);c=w;var l=p(t,n,o);if("normal"===l.type){if(c=o.done?L:v,l.arg===x)continue;return{value:l.a {snip}
  File "app:///235.js", line 1, col 423, in p
    {snip} ,f),h}function p(t,n,o){try{return{type:"normal",arg:t.call(n,o)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var y="suspendedStart",v="su {snip}
  File "app:///235.js", line 1, col 898, in n
    {snip} s._invoke(n,t)}})}function P(t){function n(o,u,h,f){var s=p(t[o],t,u);if("throw"!==s.type){var l=s.arg,y=l.value;return y&&"object"==typeof  {snip}
  File "app:///235.js", line 1, col 1273
    {snip} nction(t,c){function u(){return new Promise(function(o,u){n(t,c,o,u)})}return o=o?o.then(u,u):u()}}function F(t,n,o){var c=y;return function {snip}
  File "app:///173.js", line 1, col 205, in c
    {snip} {return n(u)}catch(n){return t=n,o}}function c(n,u,f){try{n(u,f)}catch(n){return t=n,o}}function _(t){if('object'!=typeof this)throw new Typ {snip}
  File "app:///173.js", line 1, col 1623, in b
    {snip} typeof t?t:null,this.promise=o}function b(n,u){var f=!1,_=c(n,function(n){f||(f=!0,p(u,n))},function(n){f||(f=!0,v(u,n))});f||_!==o||(f=!0,v {snip}
  File "app:///173.js", line 1, col 488, in _
    {snip} ;this._40=0,this._65=0,this._55=null,this._72=null,t!==n&&b(t,this)}function s(t,o,u){return new t.constructor(function(f,c){var s=new _(n); {snip}
  File "app:///235.js", line 1, col 1257, in u
    {snip} ;this._invoke=function(t,c){function u(){return new Promise(function(o,u){n(t,c,o,u)})}return o=o?o.then(u,u):u()}}function F(t,n,o){var c=y {snip}
  File "app:///235.js", line 1, col 1309
    {snip} Promise(function(o,u){n(t,c,o,u)})}return o=o?o.then(u,u):u()}}function F(t,n,o){var c=y;return function(u,h){if(c===w)throw new Error("Gene {snip}
  File "app:///235.js", line 1, col 3681
    {snip} =new P(l(n,o,c,u));return t.isGeneratorFunction(o)?h:h.next().then(function(t){return t.done?t.value:h.next()})},N(G),G[s]="Generator",G[h]= {snip}
  File "app:///876.js", line 1, col 2816, in E
    {snip} rn n.stop()}})}function E(t,n){var c;return u.default.async(function(f){for(;;)switch(f.prev=f.next){case 0:if(p(t)){f.next=2;break}return f {snip}
  File "app:///879.js", line 1, col 6510
    {snip} .next){case 0:return t.next=2,n.default.awrap((0,p.request)(p.PERMISSIONS.IOS.MOTION));case 2:return s=t.sent,t.abrupt("return",s);case 4:ca {snip}
  File "app:///235.js", line 1, col 423, in p
    {snip} ,f),h}function p(t,n,o){try{return{type:"normal",arg:t.call(n,o)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var y="suspendedStart",v="su {snip}
  File "app:///235.js", line 1, col 1740
    {snip} se"return"===o.method&&o.abrupt("return",o.arg);c=w;var l=p(t,n,o);if("normal"===l.type){if(c=o.done?L:v,l.arg===x)continue;return{value:l.a {snip}
  File "app:///235.js", line 1, col 423, in p
    {snip} ,f),h}function p(t,n,o){try{return{type:"normal",arg:t.call(n,o)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var y="suspendedStart",v="su {snip}
  File "app:///235.js", line 1, col 898, in n
    {snip} s._invoke(n,t)}})}function P(t){function n(o,u,h,f){var s=p(t[o],t,u);if("throw"!==s.type){var l=s.arg,y=l.value;return y&&"object"==typeof  {snip}
  File "app:///235.js", line 1, col 1273
    {snip} nction(t,c){function u(){return new Promise(function(o,u){n(t,c,o,u)})}return o=o?o.then(u,u):u()}}function F(t,n,o){var c=y;return function {snip}
  File "app:///173.js", line 1, col 205, in c
    {snip} {return n(u)}catch(n){return t=n,o}}function c(n,u,f){try{n(u,f)}catch(n){return t=n,o}}function _(t){if('object'!=typeof this)throw new Typ {snip}
  File "app:///173.js", line 1, col 1623, in b
    {snip} typeof t?t:null,this.promise=o}function b(n,u){var f=!1,_=c(n,function(n){f||(f=!0,p(u,n))},function(n){f||(f=!0,v(u,n))});f||_!==o||(f=!0,v {snip}
  File "app:///173.js", line 1, col 488, in _
    {snip} ;this._40=0,this._65=0,this._55=null,this._72=null,t!==n&&b(t,this)}function s(t,o,u){return new t.constructor(function(f,c){var s=new _(n); {snip}
  File "app:///235.js", line 1, col 1257, in u
    {snip} ;this._invoke=function(t,c){function u(){return new Promise(function(o,u){n(t,c,o,u)})}return o=o?o.then(u,u):u()}}function F(t,n,o){var c=y {snip}
  File "app:///235.js", line 1, col 1309
    {snip} Promise(function(o,u){n(t,c,o,u)})}return o=o?o.then(u,u):u()}}function F(t,n,o){var c=y;return function(u,h){if(c===w)throw new Error("Gene {snip}
  File "app:///235.js", line 1, col 3681
    {snip} =new P(l(n,o,c,u));return t.isGeneratorFunction(o)?h:h.next().then(function(t){return t.done?t.value:h.next()})},N(G),G[s]="Generator",G[h]= {snip}
  File "app:///879.js", line 1, col 6416
    {snip} ction x(){return function(t,o){var s;return n.default.async(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.default.awrap( {snip}
  File "app:///1731.js", line 1, col 954
    {snip}  n.next=5,s.default.awrap(t.screenProps.askMotionPermission());case 5:return n.next=7,s.default.awrap(t.screenProps.askNotificationsPermissi {snip}
  File "app:///235.js", line 1, col 423, in p
    {snip} ,f),h}function p(t,n,o){try{return{type:"normal",arg:t.call(n,o)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var y="suspendedStart",v="su {snip}
  File "app:///235.js", line 1, col 1740
    {snip} se"return"===o.method&&o.abrupt("return",o.arg);c=w;var l=p(t,n,o);if("normal"===l.type){if(c=o.done?L:v,l.arg===x)continue;return{value:l.a {snip}
  File "app:///235.js", line 1, col 423, in p
    {snip} ,f),h}function p(t,n,o){try{return{type:"normal",arg:t.call(n,o)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var y="suspendedStart",v="su {snip}
  File "app:///235.js", line 1, col 898, in n
    {snip} s._invoke(n,t)}})}function P(t){function n(o,u,h,f){var s=p(t[o],t,u);if("throw"!==s.type){var l=s.arg,y=l.value;return y&&"object"==typeof  {snip}
  File "app:///235.js", line 1, col 1047
    {snip} (y,"__await")?Promise.resolve(y.__await).then(function(t){n("next",t,h,f)},function(t){n("throw",t,h,f)}):Promise.resolve(y).then(function(t {snip}
  File "app:///173.js", line 1, col 155, in f
    {snip}  n.then}catch(n){return t=n,o}}function f(n,u){try{return n(u)}catch(n){return t=n,o}}function c(n,u,f){try{n(u,f)}catch(n){return t=n,o}}fu {snip}
  File "app:///173.js", line 1, col 882
    {snip} c=1===n._65?u.onFulfilled:u.onRejected;if(null!==c){var _=f(c,n._55);_===o?v(u.promise,t):p(u.promise,_)}else 1===n._65?p(u.promise,n._55):v {snip}
  File "app:///237.js", line 1, col 661, in y
    {snip} y{'setTimeout'===h||'setInterval'===h||'setImmediate'===h?I():'requestAnimationFrame'===h?I(o()):'requestIdleCallback'===h?I({timeRemaining: {snip}
  File "app:///237.js", line 1, col 1025, in C
    {snip} length>0){var t=h.slice();h=[];for(var n=0;n<t.length;++n)y(t[n],0)}return h.length>0}function A(t){v[t]=null,f[t]=null,s[t]=null,b[t]=null} {snip}
  File "app:///237.js", line 1, col 3100, in callImmediates
    {snip} on(){throw t},0)})}},callImmediates:function(){for(w=null;C(););w&&w.forEach(function(t){return F.setTimeout(function(){throw t},0)})},emitT {snip}
  File "app:///[native code]", in callImmediates
  File "app:///161.js", line 1, col 3247, in value
    {snip} '),null!=this._immediatesCallback&&this._immediatesCallback(),n.endEvent()}},{key:"__callFunction",value:function(t,l,u){this._lastFlush=Dat {snip}
  File "app:///161.js", line 1, col 1283
    {snip} ion(){var t=this;this.__guard(function(){t.__callImmediates()});var l=this._queue;return this._queue=[[],[],[],this._callID],l[0].length?l:n {snip}
  File "app:///161.js", line 1, col 2939, in value
    {snip} e:function(t){if(this.__shouldPauseOnThrow())t();else try{t()}catch(t){s.reportFatalError(t)}}},{key:"__shouldPauseOnThrow",value:function() {snip}
  File "app:///161.js", line 1, col 1253, in value
    {snip} key:"flushedQueue",value:function(){var t=this;this.__guard(function(){t.__callImmediates()});var l=this._queue;return this._queue=[[],[],[] {snip}
  File "app:///[native code]", in value
  File "app:///[native code]", in value

Unminified

Error: The operation couldn鈥檛 be completed. (CMErrorDomain error 103.)
  File "node_modules/react-native-permissions/src/index.ts", line 110, col 8
    export async function request(
  File "node_modules/regenerator-runtime/runtime.js", line 45, col 7, in abrupt
    return { type: "normal", arg: fn.call(obj, arg) };
  File "node_modules/regenerator-runtime/runtime.js", line 266, col 19
    context.abrupt("return", context.arg);
  File "node_modules/regenerator-runtime/runtime.js", line 45, col 7, in generator
    return { type: "normal", arg: fn.call(obj, arg) };
  File "node_modules/regenerator-runtime/runtime.js", line 133, col 26, in this
    function AsyncIterator(generator) {
  File "node_modules/regenerator-runtime/runtime.js", line 169, col 9, in ex
    return new Promise(function(resolve, reject) {
  File "node_modules/promise/setimmediate/core.js", line 39, col 18, in c
    LAST_ERROR = ex;
  File "node_modules/promise/setimmediate/core.js", line 198, col 1, in _55
    function doResolve(fn, promise) {
  File "node_modules/promise/setimmediate/core.js", line 63, col 8, in _
    this._55 = null;
  File "node_modules/regenerator-runtime/runtime.js", line 168, col 7, in reject
    function callInvokeWithMethodAndArg() {
  File "node_modules/regenerator-runtime/runtime.js", line 170, col 40, in isGeneratorFunction
    invoke(method, arg, resolve, reject);
  File "node_modules/regenerator-runtime/runtime.js", line 214, col 20
    return exports.isGeneratorFunction(outerFn)
  File "node_modules/react-native-permissions/src/index.ts", line 110, col 8, in _regenerator
    export async function request(
  File "src/actions/appState.js", line 182, col 10
    return async (dispatch, getState) => {
  File "node_modules/regenerator-runtime/runtime.js", line 45, col 7, in abrupt
    return { type: "normal", arg: fn.call(obj, arg) };
  File "node_modules/regenerator-runtime/runtime.js", line 266, col 19
    context.abrupt("return", context.arg);
  File "node_modules/regenerator-runtime/runtime.js", line 45, col 7, in generator
    return { type: "normal", arg: fn.call(obj, arg) };
  File "node_modules/regenerator-runtime/runtime.js", line 133, col 26, in this
    function AsyncIterator(generator) {
  File "node_modules/regenerator-runtime/runtime.js", line 169, col 9, in ex
    return new Promise(function(resolve, reject) {
  File "node_modules/promise/setimmediate/core.js", line 39, col 18, in c
    LAST_ERROR = ex;
  File "node_modules/promise/setimmediate/core.js", line 198, col 1, in _55
    function doResolve(fn, promise) {
  File "node_modules/promise/setimmediate/core.js", line 63, col 8, in _
    this._55 = null;
  File "node_modules/regenerator-runtime/runtime.js", line 168, col 7, in reject
    function callInvokeWithMethodAndArg() {
  File "node_modules/regenerator-runtime/runtime.js", line 170, col 40, in isGeneratorFunction
    invoke(method, arg, resolve, reject);
  File "node_modules/regenerator-runtime/runtime.js", line 214, col 20
    return exports.isGeneratorFunction(outerFn)
  File "src/actions/appState.js", line 182, col 10, in screenProps
    return async (dispatch, getState) => {
  File "src/scenes/OnboardingScene.js", line 36, col 19
    await props.screenProps.askMotionPermission()
  File "node_modules/regenerator-runtime/runtime.js", line 45, col 7, in abrupt
    return { type: "normal", arg: fn.call(obj, arg) };
  File "node_modules/regenerator-runtime/runtime.js", line 266, col 19
    context.abrupt("return", context.arg);
  File "node_modules/regenerator-runtime/runtime.js", line 45, col 7, in generator
    return { type: "normal", arg: fn.call(obj, arg) };
  File "node_modules/regenerator-runtime/runtime.js", line 133, col 26, in this
    function AsyncIterator(generator) {
  File "node_modules/regenerator-runtime/runtime.js", line 144, col 34
    return Promise.resolve(value.__await).then(function(value) {
  File "node_modules/promise/setimmediate/core.js", line 35, col 1, in onRejected
    function tryCallOne(fn, a) {
  File "node_modules/promise/setimmediate/core.js", line 114, col 63
    var cb = self._65 === 1 ? deferred.onFulfilled : deferred.onRejected;
  File "node_modules/react-native/Libraries/Core/Timers/JSTimers.js", line 143, col 16, in y
    type === 'setInterval' ||
  File "node_modules/react-native/Libraries/Core/Timers/JSTimers.js", line 193, col 5, in callImmediates
    for (let i = 0; i < passImmediates.length; ++i) {
  File "node_modules/react-native/Libraries/Core/Timers/JSTimers.js", line 456, col 3, in callImmediates
    callImmediates() {
  File "app:///[native code]", in callImmediates
  File "node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js", line 406, col 14, in value
    if (this._immediatesCallback != null) {
  File "node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js", line 142, col 18, in __shouldPauseOnThrow
    this.__guard(() => {
  File "node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js", line 380, col 14, in flushedQueue
    if (this.__shouldPauseOnThrow()) {
  File "node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js", line 138, col 17, in value
    return this.flushedQueue();
  File "app:///[native code]", in value
  File "app:///[native code]", in value

Environment info

React native info output:

info Fetching system and libraries information...
System:
    OS: macOS 10.15.2
    CPU: (8) x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
    Memory: 351.50 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.6.0 - ~/.nvm/versions/node/v12.6.0/bin/node
    Yarn: 1.19.2 - /usr/local/bin/yarn
    npm: 6.13.4 - ~/.nvm/versions/node/v12.6.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.6010548
    Xcode: 11.3/11C29 - /usr/bin/xcodebuild
  npmPackages:
    react: ^16.11.0 => 16.12.0
    react-native: ^0.61.4 => 0.61.4

Library version: 2.0.3

Steps To Reproduce

  • The issue is intermittent and I couldn't reproduce it myself. But error is happening to many users (reported through Sentry).

Describe what you expected to happen:

  • For error not to be thrown

Reproducible sample code

      const permission = await request(PERMISSIONS.IOS.MOTION)
      return permission      
bug

All 6 comments

Can you upload dSYM files to Sentry to have a more precise stacktrace?

Also, could you update to the latest lib version? We fix an issue with ARC aggressively releasing permission handlers before resolving the permission status on device with very low available RAM.

It looks like CMMotionActivityManager is released too soon and it might fix it.

Updated to [email protected], but it still happens. I'm not sure if dSYM symbols would help because it shows as javascript error, it comes from https://github.com/react-native-community/react-native-permissions/blob/9d9a5d83975692f4da4d4a801e31157478897ace/src/index.ts#L119 and is being handled by javascript, so the error wouldn't show up as native error. It's a javascript error.

Either way it's unexpected and I don't know how to handle it.

As the error code corresponds to CMErrorUnknown, it's not easy to spot the issue.
I try reducing the requested CMMotionActivityManager activity time window to the maximum, it's available in the latest version (2.0.10).

i'm trying it now

FYI: the error didn't occur for at least 3 month, so I think the latest version actually did it. Thanks.

@noway Thanks for the feedback! 馃檪

Was this page helpful?
0 / 5 - 0 ratings