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

TypeError: productRepo.findWithRelationsAndCount is not a function #8

Open
ismetismetismet opened this issue Jan 17, 2024 · 5 comments

Comments

@ismetismetismet
Copy link

ismetismetismet commented Jan 17, 2024

Selam @shahednasser,

I am attempting to execute everything as explained in the documentation, but I've encountered an issue that I cannot resolve. It seems to be specific to Medusa version 1.20.0:

wilixResolutionError: Could not resolve 'loggedInUser'.

Resolution path: loggedInUser
    at resolve (/Users/korabh/git//node_modules/awilix/lib/container.js:252:23)
    at Object.get (/Users/korabh/git//node_modules/awilix/lib/container.js:66:33)
    at new ProductService (/Users/korabh/git//dist/services/product.js:30:39)
    at container.register._f.<computed>.lifetime (/Users/korabh/git//node_modules/@medusajs/medusa/dist/loaders/plugins.js:547:112)
    at Object.resolve (/Users/korabh/git//node_modules/awilix/lib/resolvers.js:295:20)
    at resolve (/Users/korabh/git//node_modules/awilix/lib/container.js:287:41)
    at Object.get (/Users/korabh/git//node_modules/awilix/lib/container.js:66:33)
    at new CartService (/Users/korabh/git//node_modules/@medusajs/medusa/dist/services/cart.js:130:259)
    at /Users/korabh/git//node_modules/@medusajs/medusa/dist/loaders/services.js:26:82
 Subscribers initialized  4ms
 API initialized  12ms
 Initializing defaults
warn:    You don't have any notification provider plugins installed. You may want to add one to your project.
 Defaults initialized  22ms
 Initializing search engine indexing
 Indexing event emitted  1ms

and once the app is running:

error:   productRepo.findWithRelationsAndCount is not a function
TypeError: productRepo.findWithRelationsAndCount is not a function
    at ProductService.<anonymous> (/Users/git/medusa/node_modules/@medusajs/medusa/dist/services/product.js:211:58)

Any ideas on how to resolve this issue?

Thank you!

@ismetismetismet
Copy link
Author

I also changed Lifetime.TRANSIENT to Lifetime.SCOPED, but it did not work.

@ReyhanDiansa
Copy link

i have the same error productRepo.findWithRelationsAndCount is not a function, does anyone know the solution?

@YishaqG
Copy link

YishaqG commented Mar 3, 2024

@ReyhanDiansa take a look to medusajs/medusa#6139

@magicxie
Copy link

export const ProductRepository = dataSource .getRepository(Product) .extend( Object.assign( MedusaProductRepository, { target: Product } ), )

remove {...}

@KabyleBOT
Copy link

export const ProductRepository = dataSource .getRepository(Product) .extend( Object.assign( MedusaProductRepository, { target: Product } ), )

But this would override the repo, in case of using it in an other plugin !

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

5 participants