medusa
medusa copied to clipboard
When I try starting the server using the medusa-file-s3 plugin it crushes with this TypeError
Bug report
Describe the bug
When I run the server I get this error:
/home/backend/node_modules/medusa-file-s3/services/s3.js:32 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } ^
TypeError: Super expression must either be null or a function
at _inherits (/home/backend/node_modules/medusa-file-s3/services/s3.js:32:113)
at /home/backend/node_modules/medusa-file-s3/services/s3.js:47:3
at Object.
A clear and concise description of what the bug is.
System information
Medusa version (including plugins): Node.js version:v16.13.0 Database: postgresql 14.3-1.pgdg20.04+1 Operating system: Ubuntu 20.04 Browser (if relevant): Chrome medusa-file-s3: 1.1.3
Steps to reproduce the behavior
- Follow this integration steps: https://docs.medusajs.com/add-plugins/s3
- Go to server directory
- run: npm start
- See error
Expected behavior
Start server and files upload to AWS S3
This is likely because there is a mismatch between installations of medusa-interfaces.
In your Medusa project try reinstalling and restart:
$ yarn add medusa-interfaces
$ yarn start
This is likely because there is a mismatch between installations of
medusa-interfaces.In your Medusa project try reinstalling and restart:
$ yarn add medusa-interfaces $ yarn start
Thank you. When I tried that it gave me this error:
[email protected] build rm -rf dist && ./node_modules/.bin/tsc -p tsconfig.json
src/modules/invite/invite.service.ts:30:11 - error TS2345: Argument of type 'InviteServiceProps' is not assignable to parameter of type 'InviteServiceProps'. Types of property 'userService' are incompatible. Type 'import("/home/backend/src/modules/user/services/user.service").default' is not assignable to type 'import("/home/backend/node_modules/@medusajs/medusa/dist/services/user").default'.
30 super(container, configModule); ~~~~~~~~~
src/modules/order/order.subscriber.ts:73:17 - error TS2739: Type 'Product' is missing the following properties from type 'Product': store_id, store
73 const product: Product = await this.productService.retrieve(item.variant.product_id, { select: ['store_id']}); ~~~~~~~
src/modules/order/order.subscriber.ts:73:107 - error TS2322: Type '"store_id"' is not assignable to type 'keyof Product'.
73 const product: Product = await this.productService.retrieve(item.variant.product_id, { select: ['store_id']}); ~~~~~~~~~~
src/modules/product/services/product.service.ts:46:5 - error TS2416: Property 'prepareListQuery_' in type 'ProductService' is not assignable to the same property in base type 'ProductService'. Type '(selector: object, config: object) => object' is not assignable to type '(selector: FilterableProductProps | Selector<Product>, config: FindProductConfig) => { q: string; relations: (keyof Product)[]; query: FindWithoutRelationsOptions; }'. Type '{}' is missing the following properties from type '{ q: string; relations: (keyof Product)[]; query: FindWithoutRelationsOptions; }': q, relations, query
46 prepareListQuery_(selector: object, config: object): object { ~~~~~~~~~~~~~~~~~
src/modules/store/services/store.service.ts:31:2 - error TS2416: Property 'withTransaction' in type 'StoreService' is not assignable to the same property in base type 'StoreService'. Type '(transactionManager: EntityManager) => StoreService' is not assignable to type '(transactionManager?: EntityManager) => StoreService | this'. Type 'StoreService' is not assignable to type 'StoreService | this'. Type 'import("/home/backend/src/modules/store/services/store.service").default' is not assignable to type 'import("/home/backend/node_modules/@medusajs/medusa/dist/services/store").default'. Types of property 'retrieve' are incompatible. Type '(relations?: string[]) => Promise<Store>' is not assignable to type '(config?: FindConfig<Store>) => Promise<Store>'. Types of parameters 'relations' and 'config' are incompatible. Type 'FindConfig<Store>' is missing the following properties from type 'string[]': length, pop, push, concat, and 29 more.
31 withTransaction(transactionManager: EntityManager): StoreService { ~~~~~~~~~~~~~~~
src/modules/store/services/store.service.ts:98:15 - error TS2416: Property 'retrieve' in type 'StoreService' is not assignable to the same property in base type 'StoreService'. Type '(relations?: string[]) => Promise<Store>' is not assignable to type '(config?: FindConfig<Store>) => Promise<Store>'. Types of parameters 'relations' and 'config' are incompatible. Type 'FindConfig<Store>' is not assignable to type 'string[]'.
98 public async retrieve(relations: string[] = []) { ~~~~~~~~
src/modules/store/services/store.service.ts:100:26 - error TS2559: Type 'string[]' has no properties in common with type 'FindConfig<Store>'.
100 return super.retrieve(relations); ~~~~~~~~~
src/modules/store/services/store.service.ts:107:4 - error TS2769: No overload matches this call. Overload 1 of 2, '(options: FindOneOptions<Store>): Promise<Store>', gave the following error. Type '(qb: any) => void' is not assignable to type 'FindOptionsWhere<Store> | FindOptionsWhere<Store>[]'. Overload 2 of 2, '(options: FindOneOptions<Store>): Promise<Store>', gave the following error. Type '(qb: any) => void' is not assignable to type 'FindOptionsWhere<Store> | FindOptionsWhere<Store>[]'.
107 where: (qb) => { ~~~~~
node_modules/typeorm/find-options/FindOneOptions.d.ts:23:5 23 where?: FindOptionsWhere<Entity>[] | FindOptionsWhere<Entity>; ~~~~~ The expected type comes from property 'where' which is declared here on type 'FindOneOptions<Store>' node_modules/typeorm/find-options/FindOneOptions.d.ts:23:5 23 where?: FindOptionsWhere<Entity>[] | FindOptionsWhere<Entity>; ~~~~~ The expected type comes from property 'where' which is declared here on type 'FindOneOptions<Store>'
src/modules/user/services/user.service.ts:32:5 - error TS2416: Property 'withTransaction' in type 'UserService' is not assignable to the same property in base type 'UserService'. Type '(transactionManager: EntityManager) => UserService' is not assignable to type '(transactionManager?: EntityManager) => UserService | this'. Type 'UserService' is not assignable to type 'UserService | this'. Type 'import("/home/backend/src/modules/user/services/user.service").default' is not assignable to type 'import("/home/backend/node_modules/@medusajs/medusa/dist/services/user").default'. Property 'container' is private in type 'UserService' but not in type 'UserService'.
32 withTransaction(transactionManager: EntityManager): UserService { ~~~~~~~~~~~~~~~
src/modules/user/services/user.service.ts:42:16 - error TS2551: Property 'transactionManager' does not exist on type 'UserService'. Did you mean 'transactionManager_'?
42 cloned.transactionManager = transactionManager ~~~~~~~~~~~~~~~~~~
node_modules/@medusajs/medusa/dist/services/user.d.ts:22:15 22 protected transactionManager_: EntityManager; ~~~~~~~~~~~~~~~~~~~ 'transactionManager_' is declared here.
src/modules/user/services/user.service.ts:49:34 - error TS2339: Property 'validateId_' does not exist on type 'UserService'.
49 const validatedId = this.validateId_(userId); ~~~~~~~~~~~
src/modules/user/services/user.service.ts:66:22 - error TS2339: Property 'buildQuery_' does not exist on type 'UserService'.
66 return super.buildQuery_(selector, config); ~~~~~~~~~~~
Found 12 errors in 5 files.
Errors Files 1 src/modules/invite/invite.service.ts:30 2 src/modules/order/order.subscriber.ts:73 1 src/modules/product/services/product.service.ts:46 4 src/modules/store/services/store.service.ts:31 4 src/modules/user/services/user.service.ts:32
Hi @Wingrammer - did you find a workaround ? I face the same issue after having installed the medusa-extender and tried the first step of the medusa marketplace blog post.
Im having that same problem, any luck?
Clone the Medusa marketplace as @nicolama-dev suggested. That implementation uses MINIO though. If you insist on using AWS S3 bucket, you would have to use a custom route with multer-s3 to do it yourself