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

Production Build #2

Open
MarkRabey opened this issue Feb 19, 2019 · 7 comments
Open

Production Build #2

MarkRabey opened this issue Feb 19, 2019 · 7 comments

Comments

@MarkRabey
Copy link

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.
screen shot 2019-02-19 at 3 49 53 pm

@coturiv
Copy link
Owner

coturiv commented Feb 20, 2019

Can you please show me sample code, or create a repo to test? I don't see any error on the production build.

@MarkRabey
Copy link
Author

I'll get a sample repo up as soon as I can. Unfortunately I can't share this particular project.

@MarkRabey
Copy link
Author

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().

@MarkRabey
Copy link
Author

On a probably unrelated note, I get an error after just cloning the repository and building the project.
screen shot 2019-02-20 at 4 14 22 pm

@MarkRabey
Copy link
Author

And this error when not using the --prod option.
screen shot 2019-02-20 at 4 19 33 pm

@StephaneSeyvoz
Copy link

StephaneSeyvoz commented Oct 16, 2019

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 f7c0778.

The submitted solution both worked in dev and prod mode on my emulator and real device.

@Sampath-Lokuge
Copy link

Hi @coturiv Any update about the above issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants