ionic-typeorm-starter
ionic-typeorm-starter copied to clipboard
Production Build
First of all, thanks for the this fork. It got me running Ionic 4 with Typeorm.
However, when I build for production (ionic cordova run android --prod
) I am unable to run my app. I have devices connected to DevTools and in the console I see the messages in the attached images. (App name is blurred out). StorageLocation
is one of my entities, so I imagine StorageLocation_1
is trying to reference that table or something. Any help is greatly appreciated.
Can you please show me sample code, or create a repo to test? I don't see any error on the production build.
I'll get a sample repo up as soon as I can. Unfortunately I can't share this particular project.
I made a repo showing that has error: https://github.com/MarkRabey/typeorm-errors
This was made by cloning this repo, and adding my Entities. I also removed the code inside runDemo()
.
On a probably unrelated note, I get an error after just cloning the repository and building the project.
And this error when not using the --prod
option.
Hi,
I was taking a look at this starter project and had the same
ERROR Error: Uncaught (in promise): RepositoryNotFoundError: No repository for "post" was found. Looks like this entity is not registered in current "default" connection?
as @MarkRabey in dev mode, both with an Android 9 (API level 28) emulator image and an Android 7 device, using the Ionic 5.4.4 and Cordova 9.0.0 as global CLI tools.
After some digging, it seems that such issues happen with TypeORM when trying to invoke getRepository('post') when the underlying database adapter isn't ready.
I found that by debugging with halt on All + Uncaught Exceptions, a "Cannot read property 'openDatabase' of undefined" happened before this error, which is often related to the platform.ready() event.
I tried a few things and found a simple working solution. I'm submitting it to you in Pull Request #5 / commit https://github.com/coturiv/ionic4-typeorm-starter/pull/5/commits/f7c0778f20d43531c5630e32a80fc57b8d5915ed.
The submitted solution both worked in dev and prod mode on my emulator and real device.
Hi @coturiv Any update about the above issue?