livestore icon indicating copy to clipboard operation
livestore copied to clipboard

Expo error: `FunctionCallException: Calling the 'createChangesetSync`

Open LydiaF opened this issue 10 months ago • 1 comments

Here is a repro repo: https://github.com/LydiaF/livestore-app

This is what I changed:


boot={(store) => {
          // if (store.query(tables.todos.count()) === 0) {
          store.commit(events.todoCreated({ id: "1", text: 'Make coffee' }))
          // }
        }}

'v1.TodoCreated': ({ id, text }, ctx) => {
    const exists = ctx.query(tables.todos.where({ id }))

    if (exists.length > 0) {
      return []
    }

    return tables.todos.insert({ id, text, completed: false })
  },

and I am getting this error on the second time and every time after the app loads...

 ERROR  [Error: FunctionCallException: Calling the 'createChangesetSync' function has failed (at ExpoModulesCore/SyncFunctionDefinition.swift:137)
→ Caused by: SQLiteErrorException: Error code 0: not an error (at ExpoSQLite/SQLiteModule.swift:740)]
 ERROR  [Error: FunctionCallException: Calling the 'createChangesetSync' function has failed (at ExpoModulesCore/SyncFunctionDefinition.swift:137)
→ Caused by: SQLiteErrorException: Error code 0: not an error (at ExpoSQLite/SQLiteModule.swift:740)]
 ERROR  Warning: LiveStore.UnexpectedError: { "cause": UnknownException: An unknown error occurred in Effect.try, "note": undefined, "payload": undefined }

  42 |         boot={(store) => {
  43 |           // if (store.query(tables.todos.count()) === 0) {
> 44 |           store.commit(events.todoCreated({ id: "1", text: 'Make coffee' }))
     |                       ^
  45 |           // }
  46 |         }}
  47 |         batchUpdates={batchUpdates}

Call Stack
  LiveStoreProvider.props.boot (src/Root.tsx:44:23)

Thank you very much for looking into this :)

LydiaF avatar Jun 05 '25 12:06 LydiaF

the root cause is actually coming from expo-sqlite and i have a solution pr at https://github.com/expo/expo/pull/37246. thanks for sharing the issue

Kudo avatar Jun 05 '25 20:06 Kudo

Closing as this has been fixed upstream in Expo. Will probably take a few days before this is available in Expo Go as well.

schickling avatar Jun 06 '25 09:06 schickling

Okay, great, thanks! I didn't figure out how to try the pr so I will just wait for the release :)

LydiaF avatar Jun 06 '25 11:06 LydiaF

i published [email protected] for the fix. please try to use npx expo run:[android|ios] or eas build instead of expo-go. because expo-go need to waits for more fixes and sends app store review in batch

Kudo avatar Jun 09 '25 03:06 Kudo

Woo, working perfectly! Thank you so much @Kudo :)

LydiaF avatar Jun 10 '25 18:06 LydiaF