-
Notifications
You must be signed in to change notification settings - Fork 36
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
EntityManager doesn't work with existing TypeORM project #47
Comments
This seems to be caused by the controller referencing a different instance of TypeORM to Vesper. Changing the import line to this solved the issue for me: |
I import { bootstrap } from "vesper";
import { ManufacturerController } from "presentation/web/controllers/manufacturer-controller";
import { Manufacturer } from "entities/manufacturer";
import { Connection, EntityManager, getManager } from "typeorm";
export const init = (connection: Connection) => new Promise(resolve => {
bootstrap({
port: 3001,
controllers: [
ManufacturerController
],
entities: [
Manufacturer
],
schemas: [
`${__dirname}/../infrastructure/schema/**/*.graphql`
],
graphIQLRoute: '/graphiql',
setupContainer: async (container, action) => {
container.set(EntityManager, getManager())
}
}).then(resolve)
}); UPDATE: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We are working with an existing TypeORM project and have been working on getting things moved over to Vesper recently. The samples work just fine but when we use our existing Database and TypeORM models the injected EntityManger in Controllers does not contain the needed connection data.
It does connect properly to the database, if we change the password it fails to start due to MySQL issues.
Here is a screenshot inside the startup of Vesper where the connection looks fine:
After startup in the controller:
Error in playground:
The text was updated successfully, but these errors were encountered: