Database failed to load WatermelonDB react-native - ios

I've got an error on react-native :
console.error: "[DB] Uh-oh. Database failed to load, we're in big trouble",
{"line":154357,"column":32,"sourceURL":"http://localhost:8081/index.bundle?platform=
ios&dev=true&minify=false"}.
Complete stack trace
I don't use expo, I do the react-native link (+ test to link manually) but nothing works 😢
Plateform : iOS 12.1, Iphone X on simulator,
Node : 11.4.0
NPM: 6.5.0
react-native-cli: 2.0.1
react-native: 0.57.7
WatermelonDB : 0.9.0
Do you have any idea of how can I debug that ?
Thanks

I faced same issue with WatermelonDB one time. It was caused by passing wrong configuration to the dataStore adapter. You may want to check your configuration incase you have same error sometime.
See my case below...
import { Database } from '#nozbe/watermelondb';
import SQLiteAdapter from '#nozbe/watermelondb/adapters/sqlite';
import { PostModel } from './Models/PostModel';
import { rootSchema } from './rootSchema';
const adapter = new SQLiteAdapter({
--- rootSchema, // invalid, what caused error
+++ schema: rootSchema, // valid configuration
});
const database = new Database({
adapter,
modelClasses: [
PostModel,
...

Related

Error showing as Extra argument 'eventDispatcher' in call while running react-native app

I am using expo-modules-core ("expo-modules-core": "^0.9.2").
I have tried npm install and pod install from my terminal and dependencies are successfully installed.
Then I tried to run the app with Xcode 13.0 with the iOS15.0 simulator but I am getting the following error and it becomes build failed.
node_modules/expo-modules-core/ios/Swift/Views/ComponentData.swift:22:84: Extra argument 'eventDispatcher' in call
The error showing in the following method inside the file (node_modules/expo-modules-core/ios/Swift/Views/ComponentData.swift).
public init(viewModule: ViewModuleWrapper, managerClass: ViewModuleWrapper.Type, bridge: RCTBridge) {
self.moduleHolder = viewModule.wrappedModuleHolder
super.init(managerClass: managerClass, bridge: bridge, eventDispatcher: bridge.eventDispatcher())
}
Could you help me how to resolve this issue?
We can fix this issue by downgrading "expo-modules-core": "~0.6.4",

KMM error: This API is internal in ktor and should not be used. It could be removed or changed without notice

After updating Xcode to 13.0, I cannot run my iOS app which is using Kotlin Multiplatform.
Build fails with Command PhaseScriptExecution failed with a nonzero exit code, and it says that the error is:
Task :shared:compileKotlinIos FAILED
e: /Users...path.../KtorClient.kt: (134, 17): This API is internal in ktor and should not be used. It could be removed or changed without notice.
We have also had similar errors after updating to Xcode 13, but it is always something with shared KMM library, JDK etc... This error showed many times:
> Process ‘command ‘/Library/Java/JavaVirtualMachines/jdk-11.0.12.jdk/Contents/Home/bin/java’' finished with non-zero exit value 1
134 line of KtorClient.kt:
override suspend fun createPassword(email: String, password: String): CreatePasswordResponse {
return client.post {
url {
path("v1", "user", "create_password")
body = LoginRequest(email, password)
}
headers {
/*134.line*/ append(HttpHeaders.ContentType, ContentType.Application.Json)
}
}
}
We have tried deleting XCWorkspace, Podfile.lock, Pods folder, then pod reinstalling, deleting derived data, nothing helped.
We have also tried different versions of Ktor, JDK, nothing helped.
Also this command found on the Internet didnt help(they say you should run it after updating Xcode):
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
This is a known issue of Ktor, related to this fix in Kotlin.
Here's what documentation says:
Note that the StringValuesBuilder class that exposes the append function is incorrectly marked with the InternalAPI annotation. This issue will be fixed in v2.0.0. As a workaround, you can add the #OptIn(InternalAPI::class) annotation to explicitly opt-in to use this API.
You can opt-in your specific line with #OptIn(InternalAPI::class), or add this in your shared module build.gradle.kts to take effect on the whole module:
kotlin {
// ..
sourceSets {
all {
languageSettings.optIn("io.ktor.util.InternalAPI")
}
// ...
}
}

Amplify: Expo Could not connect to development server

I have a React-Native app, using AWS Amplify that works with Expo when testing using expo start --web, but I am trying to test on my iOS device and get a Could not connect to development server. Error. URL: http://192.168.1.6:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=ios&dev=true&hot=false&minify=false
EDIT: I have tried starting a blank project, using amplify pull, and then this error occurs:
jest-haste-map: Haste module naming collision: projectamplifyjsc7fc9745PostConfirmation
The following files share their name; please adjust your hasteImpl:
* <rootDir>\amplify\#current-cloud-backend\function\projectamplifyjsc7fc9745PostConfirmation\src\package.json
* <rootDir>\amplify\backend\function\projectamplifyjsc7fc9745PostConfirmation\src\package.json
Failed to construct transformer: DuplicateError: Duplicated files or mocks. Please check the console for more info
at setModule (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:620:17)
at workerReply (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:691:9)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Promise.all (index 50) {
mockPath1: 'amplify\\#current-cloud-backend\\function\\projectamplifyjsc7fc9745PostConfirmation\\src\\package.json',
mockPath2: 'amplify\\backend\\function\\projectamplifyjsc7fc9745PostConfirmation\\src\\package.json'}
Error: Duplicated files or mocks. Please check the console for more info
at setModule (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:620:17)
at workerReply (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:691:9)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Promise.all (index 50)
Error: Duplicated files or mocks. Please check the console for more info
at setModule (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:620:17)
at workerReply (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:691:9)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Promise.all (index 50)
What is this and how to fix?
This answer comes from someone who had a similar issue with the Amplify API, find it here: Amplify React Native - Duplicate Error using amplify add api
Solution is simple (at least for me, guess it could depend on what amplify services you use).
Amplify creates a copy of your current cloud backend configuration in
amplify/#current-cloud-backend/.
You don't need those files to build your app, so you can ignore them
in order to get rid of the error.
To do so, you can create a blacklist and add the folder to it. Create
a rn-cli.config.js file in the root of your project.
./rn-cli.config.js:
require('metro').createBlacklist;
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = { resolver: {
blacklistRE: blacklist([/#current-cloud-backend\/.*/]), }, }; ```
See answer given here: https://stackoverflow.com/a/60899723/11255886

How to fix find error for dart:html in VSCode?

I try to run in VSCode a simple dart program with
import 'dart:html';
clause.
import 'dart:html';
// import 'package:html/dom.dart';
// import 'package:html/dom_parsing.dart';
// import 'package:html/parser.dart';
void main() async{
var myTable = new TableElement()
..setAttribute('border','1');
// ..setAttribute(name, value);
...
In Run mode (I use VSCode extension "Code Runner 0.9.9") and in Debug appeared the same error:
Error: Not found: 'dart:html'
import 'dart:html';
I have installed Dart SDK 2.3.1 at Windows10 and not installed Flutter at all.
PATH pointed to Dart SDK bin directory
PATH =D:\Dart\dart-sdk\bin;
*) At project directory I try to add additional directive at pubspec.yaml
dependencies:
----
name: main
description: Test App sample22
dependencies:
html:
---
After "pub get" command I'll see that html present but error still persist.
pub get
Resolving dependencies...
+ charcode 1.1.2
+ csslib 0.16.0
+ html 0.14.0+2
+ path 1.6.2
+ source_span 1.5.5
+ term_glyph 1.1.0
Changed 6 dependencies!
*) My next step was to import html parts via "package:html/" (marked as comments in code sample). It is not helped and required class TableElement still unrecognizable.
"main.dart:8:19: Error: Method not found: 'TableElement'."
*) I try to change "launch.json" string from
default
"program": "bin/main.dart",
to
"program": "D:/Dart/WRK03t/main.dart",
And rename my code file to "main.dart"
*) Also I try to remove Dart extension from VSCode, restart PC and install it again. it's not helped.
But let me say that when I compile main.dart to js
"dart2js -m -o tst.js main.dart"
Resulted tst.js run correctly within the html page.
Almost the same problem in Request Dart Installation doesnt find dart:html
dart:html is only available in the browser. This is the error you get if you try to run code that uses it on the VM (instead of the browser). This is expected.
If you need to run your code outside of the browser (eg. in the VM as a CLI app or via Fluter) you cannot use dart:html. If you only want to use it in the browser but VS Code is trying to run your code in the VM, you'll need to set up some VS Code tasks/launch configs to run build_runner, similar to the Dart DevTools project:
https://github.com/flutter/devtools/tree/abe811f66e1bd36612b76bbe28250bc669a6ce08/.vscode

Apcelerator ios Build Failed issue

I have iOS app which is working fine if I run it without adding gplus module. As soon as I add it in my project it gives below error.
[ERROR] : ** BUILD FAILED **
[ERROR] : The following build commands failed:
[ERROR] : Ld build/Products/Debug-iphonesimulator/ABC.app/ABC normal x86_64
[ERROR] : (1 failure)
I tried to rebuild the module on my own for this source code and added the module in my app, still same issue exist.
Below is my configuration:
Mac OS : Mac OS X (10.13.3)
Node.js Version : 8.9.1
npm Version : 5.5.1
CLI Version : 5.1.1
SDK Version : 7.2.0.GA
Xcode : 9.4.1
Gplus Module Source Code version: 1.4.0
I will be very thankful if you let me know, what I am doing wrong.

Resources