Skip to content

"Illegal callback invocation from native module." on syncDown #163

@jpmonette

Description

@jpmonette

Describe the bug
When I try to create a new syncDown following registering soup, deleting soup, and registering soup, the app turns into an unrecoverable state (and cannot catch error):

Illegal callback invocation from native module. This callback type only permits a single invocation from native code.

To Reproduce
Steps to reproduce the behavior:

// Promise-fying calls + importing salesforce-queries

const sobject = 'Account';
const indexSpecs = ['Id']

const target = {
  type: 'soql',
  query: new SOQL(sobject)
    .select(indexSpecs)
    .limit(10000)
    .build(),
};

const options = { mergeMode: mobileSync.MERGE_MODE.OVERWRITE };

await smartStore.registerSoup(false, sobject, indexSpecs)
await mobileSync.syncDown(false, target, sobject, options, sobject)
await mobileSync.deleteSync(false, sobject)
await smartStore.removeAllStores()
await smartStore.registerSoup(false, sobject, indexSpecs)
await mobileSync.syncDown(false, target, sobject, options, sobject) // boom! 💥

This will throw error + prevent to call syncDown successfully again. Only way is to stop the application + re-build.

Expected behavior
Step 6 would allow to run syncDown successfully.

Actual behavior
Steps 6 returns:

Illegal callback invocation from native module. This callback type only permits a single invocation from native code.

Versions (please complete the following information):

  • v8.1.0

Trace

RCTFatal
checkCallbackMultipleInvocations(bool*)
__41-[RCTModuleMethod processMethodSignature]_block_invoke_2.106
-[SFMobileSyncReactBridge handleSyncUpdate:withArgs:callback:]
__45-[SFMobileSyncReactBridge syncDown:callback:]_block_invoke
__113-[SFMobileSyncSyncManager(Instrumentation) instr_syncDownWithTarget:options:soupName:syncName:updateBlock:error:]_block_invoke
-[SFSyncTask updateSync:countSynched:]
-[SFAdvancedSyncUpTask syncUpMultipleEntries:recordIds:index:batch:]
-[SFAdvancedSyncUpTask syncUp:recordIds:]
-[SFSyncUpTask runSync:]
-[SFSyncTask run]
__47-[SFMobileSyncSyncManager runSync:updateBlock:]_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_lane_serial_drain
_dispatch_lane_invoke
_dispatch_workloop_worker_thread
_pthread_wqthread
start_wqthread

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions