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

Error: Database has an unsupported version (9) and cannot be upgraded, js engine: hermes, #6899

Closed
Pingou opened this issue Sep 29, 2024 · 7 comments

Comments

@Pingou
Copy link

Pingou commented Sep 29, 2024

How frequently does the bug occur?

Sometimes

Description

Some users are crashing with the Error: Database has an unsupported version (9) and cannot be upgraded, js engine: hermes message.
Does that mean that if a user has an old version of my app because they disabled automatic updates, then they are s.o.l?

Stacktrace & log output

Fatal Exception: com.facebook.react.common.JavascriptException: Error: Database has an unsupported version (9) and cannot be upgraded, js engine: hermes, stack:
getSharedRealm@1:866814
Realm@1:1080086
anonymous@1:841222
loadModuleImplementation@1:80600
guardedLoadModule@1:80124
metroRequire@1:79754
anonymous@1:723470
loadModuleImplementation@1:80600
guardedLoadModule@1:80124
metroRequire@1:79754
anonymous@1:701659
loadModuleImplementation@1:80600
guardedLoadModule@1:80124
metroRequire@1:79754
anonymous@1:86644
loadModuleImplementation@1:80600
guardedLoadModule@1:80081
metroRequire@1:79754
global@1:79282

       at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:65)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
       at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:146)
       at com.facebook.jni.NativeRunnable.run(NativeRunnable.java)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
       at android.os.Looper.loop(Looper.java:246)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:233)
       at java.lang.Thread.run(Thread.java:923)

Can you reproduce the bug?

No

Reproduction Steps

No response

Version

12.13.1

What services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

Android, rn 74.5

Build environment

Which debugger for React Native: ..

Cocoapods version

No response

Copy link

sync-by-unito bot commented Sep 29, 2024

➤ PM Bot commented:

Jira ticket: RJS-2906

@jayshah123
Copy link

jayshah123 commented Oct 8, 2024

I am also facing this issue on iOS only.
I had upgraded sdk from 12.6.2 to 12.13.1, then downgraded from 12.13.1 to 12.11.1 but I still see this issue.
I use realm just for local operations.
What is the recommended upgrade path and fix here?

@Pingou
Copy link
Author

Pingou commented Oct 22, 2024

@kraenhansen is there anyway to catch this error and do something with the database?
The error comes from the C code right?

@kraenhansen
Copy link
Member

This version of the database file format (9) is 4 years old (from Realm Core v5).

Beginning with RealmCore v14.0.0, you can only upgrade from version 10 and upwards. This means you'd have to pick a version of Realm JS using a Realm Core version lower than v14 to first upgrade the client and then upgrade Realm JS to a recent version in their app.

Sorry for the inconvenience this may cause, but it's an important goal of ours to keep the binary size of Realm Core low and removing migration logic to upgrade database files from ancient file format versions is one way to keep the size of the library low.

@kraenhansen kraenhansen closed this as not planned Won't fix, can't repro, duplicate, stale Oct 22, 2024
@Pingou
Copy link
Author

Pingou commented Oct 22, 2024

@kraenhansen Thank you for the reply.
I think you should have a very big warning on the github page, because it means that many users will lose all their data as there is no way to ensure that they will regularly update the app (unless you want to bypass Apple and Google and do some autoupdate thing, and even then it wouldn't work all the time).
I appreciate all the work you've done but since I started using realm 7 years ago I wasted weeks on various issues (and I don't even need the complicated features), which is why I stay away from realm for all my new projects.
Sorry to be negative for something provided for free, I really appreciate but I am very frustrated.

@kraenhansen
Copy link
Member

many users will lose all their data as there is no way to ensure that they will regularly update

There is no requirement to regularly update.
Although admittedly hard to pull off, you'd need to ensure the app gets upgraded in steps that are able to upgrade the file format along the way. You would need a way to control that very old versions upgrade to some "intermediate" version of your app first, before it takes the latest version. Some tools can achieve this through release channels, having a "legacy" and a latest channel, where you cannot upgrade from legacy to latest until you're on the latest version of "legacy". That being said, this is understandably frustrating to have to deal with as a developer - I agree this could have been better designed on our part.

I appreciate all the work you've done

Thanks 🙂 It's been a blast.

which is why I stay away from realm for all my new projects.

Since the project will EOL and not longer receive active maintenance, in less than a year from now, that's probably a wise choice 👍

Sorry to be negative for something provided for free, I really appreciate but I am very frustrated.

No worries: You're entirely entitled to your opinion and thanks for calling this out. We need feedback to improve (both positive and negative).

@Pingou
Copy link
Author

Pingou commented Oct 22, 2024

@kraenhansen As far as I know there is no way to choose which binary to serve your users when they upgrade, it's all controlled by Apple and Google (I am talking about apps releasing on the app stores). They will always be served the last compatible versions (as in, compatible with their Android version).
I do not use the sync or Atlas feature, it's unclear if I'm impacted by their deprecation.

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

3 participants