Skip to content

The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.

fix: prefix unused req params, add multer import, document api workspace deps (#794)

Jakub Sieradzkia08d6cb081b5
diff --git a/packages/registry/r/product-import-export.json b/packages/registry/r/product-import-export.json
index 72b3d895f..3728a76c7 100644
--- a/packages/registry/r/product-import-export.json
+++ b/packages/registry/r/product-import-export.json
@@ -8,7 +8,7 @@
"@medusajs/core-flows"
],
"registryDependencies": [],
- "docs": "## Product Import/Export Block\n\n### Configuration\n\nNo additional modules needed — uses built-in Medusa product CSV steps.\n\n### Middleware Setup\n\nAdd the import middleware to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from '@medusajs/medusa'\nimport { productImportExportMiddlewares } from './vendor/products/middlewares'\n\nexport default defineMiddlewares({\n routes: [...productImportExportMiddlewares],\n})\n```\n\n### Run codegen\n\nAfter installing the block, regenerate SDK types:\n\n```bash\nnpx @mercurjs/cli@latest codegen\n```\n\n### Vendor Navigation\n\nThe block includes a `products/page.tsx` that overrides the default product list page, adding Import and Export buttons in the header. The buttons open drawer routes at `/products/import` and `/products/export`.",
+ "docs": "## Product Import/Export Block\n\n### Dependencies\n\nInstall dependencies in the **API workspace** (not the project root):\n\n```bash\ncd packages/api\nbun add @medusajs/core-flows multer @types/multer\n```\n\n### Configuration\n\nNo additional modules needed — uses built-in Medusa product CSV steps.\n\n### Middleware Setup\n\nAdd the import middleware to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from '@medusajs/medusa'\nimport { productImportExportMiddlewares } from './vendor/products/middlewares'\n\nexport default defineMiddlewares({\n routes: [...productImportExportMiddlewares],\n})\n```\n\n### Run codegen\n\nAfter installing the block, regenerate SDK types:\n\n```bash\nnpx @mercurjs/cli@latest codegen\n```\n\n### Vendor Navigation\n\nThe block includes a `products/page.tsx` that overrides the default product list page, adding Import and Export buttons in the header. The buttons open drawer routes at `/products/import` and `/products/export`.",
"categories": [
"api",
"workflow",
@@ -37,7 +37,7 @@
},
{
"path": "product-import-export/api/vendor/products/import/route.ts",
- "content": "import {\n AuthenticatedMedusaRequest,\n MedusaResponse,\n} from \"@medusajs/framework/http\"\nimport { MedusaError } from \"@medusajs/framework/utils\"\nimport { importSellerProductsWorkflow } from \"../../../../workflows/import-seller-products\"\nimport { fetchSellerByAuthActorId } from \"../helpers/helpers\"\n\nexport const POST = async (\n req: AuthenticatedMedusaRequest<{ file: Express.Multer.File }>,\n res: MedusaResponse<{ summary: { created: number } }>\n) => {\n const file = (req as any).file as Express.Multer.File | undefined\n\n if (!file) {\n throw new MedusaError(\n MedusaError.Types.INVALID_DATA,\n \"No file uploaded. Please upload a CSV file.\"\n )\n }\n\n const seller = await fetchSellerByAuthActorId(\n req.auth_context.actor_id,\n req.scope\n )\n\n if (!seller) {\n throw new MedusaError(\n MedusaError.Types.NOT_FOUND,\n \"Seller not found for the current user.\"\n )\n }\n\n const fileContent = file.buffer.toString(\"utf-8\")\n\n const { result } = await importSellerProductsWorkflow(req.scope).run({\n input: {\n file_content: fileContent,\n seller_id: seller.id,\n },\n })\n\n res.status(200).json({\n summary: {\n created: Array.isArray(result) ? result.length : 0,\n },\n })\n}\n",
+ "content": "import \"multer\"\nimport {\n AuthenticatedMedusaRequest,\n MedusaResponse,\n} from \"@medusajs/framework/http\"\nimport { MedusaError } from \"@medusajs/framework/utils\"\nimport { importSellerProductsWorkflow } from \"../../../../workflows/import-seller-products\"\nimport { fetchSellerByAuthActorId } from \"../helpers/helpers\"\n\nexport const POST = async (\n req: AuthenticatedMedusaRequest<{ file: Express.Multer.File }>,\n res: MedusaResponse<{ summary: { created: number } }>\n) => {\n const file = (req as any).file as Express.Multer.File | undefined\n\n if (!file) {\n throw new MedusaError(\n MedusaError.Types.INVALID_DATA,\n \"No file uploaded. Please upload a CSV file.\"\n )\n }\n\n const seller = await fetchSellerByAuthActorId(\n req.auth_context.actor_id,\n req.scope\n )\n\n if (!seller) {\n throw new MedusaError(\n MedusaError.Types.NOT_FOUND,\n \"Seller not found for the current user.\"\n )\n }\n\n const fileContent = file.buffer.toString(\"utf-8\")\n\n const { result } = await importSellerProductsWorkflow(req.scope).run({\n input: {\n file_content: fileContent,\n seller_id: seller.id,\n },\n })\n\n res.status(200).json({\n summary: {\n created: Array.isArray(result) ? result.length : 0,\n },\n })\n}\n",
"type": "registry:api"
},
{
diff --git a/packages/registry/r/registry.json b/packages/registry/r/registry.json
index 0f9a669a3..9647bd30b 100644
--- a/packages/registry/r/registry.json
+++ b/packages/registry/r/registry.json
@@ -228,7 +228,7 @@
"@medusajs/core-flows"
],
"registryDependencies": [],
- "docs": "## Product Import/Export Block\n\n### Configuration\n\nNo additional modules needed — uses built-in Medusa product CSV steps.\n\n### Middleware Setup\n\nAdd the import middleware to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from '@medusajs/medusa'\nimport { productImportExportMiddlewares } from './vendor/products/middlewares'\n\nexport default defineMiddlewares({\n routes: [...productImportExportMiddlewares],\n})\n```\n\n### Run codegen\n\nAfter installing the block, regenerate SDK types:\n\n```bash\nnpx @mercurjs/cli@latest codegen\n```\n\n### Vendor Navigation\n\nThe block includes a `products/page.tsx` that overrides the default product list page, adding Import and Export buttons in the header. The buttons open drawer routes at `/products/import` and `/products/export`.",
+ "docs": "## Product Import/Export Block\n\n### Dependencies\n\nInstall dependencies in the **API workspace** (not the project root):\n\n```bash\ncd packages/api\nbun add @medusajs/core-flows multer @types/multer\n```\n\n### Configuration\n\nNo additional modules needed — uses built-in Medusa product CSV steps.\n\n### Middleware Setup\n\nAdd the import middleware to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from '@medusajs/medusa'\nimport { productImportExportMiddlewares } from './vendor/products/middlewares'\n\nexport default defineMiddlewares({\n routes: [...productImportExportMiddlewares],\n})\n```\n\n### Run codegen\n\nAfter installing the block, regenerate SDK types:\n\n```bash\nnpx @mercurjs/cli@latest codegen\n```\n\n### Vendor Navigation\n\nThe block includes a `products/page.tsx` that overrides the default product list page, adding Import and Export buttons in the header. The buttons open drawer routes at `/products/import` and `/products/export`.",
"files": [
{
"path": "product-import-export/workflows/steps/get-seller-products.ts",
diff --git a/packages/registry/registry.json b/packages/registry/registry.json
index 0f9a669a3..9647bd30b 100644
--- a/packages/registry/registry.json
+++ b/packages/registry/registry.json
@@ -228,7 +228,7 @@
"@medusajs/core-flows"
],
"registryDependencies": [],
- "docs": "## Product Import/Export Block\n\n### Configuration\n\nNo additional modules needed — uses built-in Medusa product CSV steps.\n\n### Middleware Setup\n\nAdd the import middleware to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from '@medusajs/medusa'\nimport { productImportExportMiddlewares } from './vendor/products/middlewares'\n\nexport default defineMiddlewares({\n routes: [...productImportExportMiddlewares],\n})\n```\n\n### Run codegen\n\nAfter installing the block, regenerate SDK types:\n\n```bash\nnpx @mercurjs/cli@latest codegen\n```\n\n### Vendor Navigation\n\nThe block includes a `products/page.tsx` that overrides the default product list page, adding Import and Export buttons in the header. The buttons open drawer routes at `/products/import` and `/products/export`.",
+ "docs": "## Product Import/Export Block\n\n### Dependencies\n\nInstall dependencies in the **API workspace** (not the project root):\n\n```bash\ncd packages/api\nbun add @medusajs/core-flows multer @types/multer\n```\n\n### Configuration\n\nNo additional modules needed — uses built-in Medusa product CSV steps.\n\n### Middleware Setup\n\nAdd the import middleware to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from '@medusajs/medusa'\nimport { productImportExportMiddlewares } from './vendor/products/middlewares'\n\nexport default defineMiddlewares({\n routes: [...productImportExportMiddlewares],\n})\n```\n\n### Run codegen\n\nAfter installing the block, regenerate SDK types:\n\n```bash\nnpx @mercurjs/cli@latest codegen\n```\n\n### Vendor Navigation\n\nThe block includes a `products/page.tsx` that overrides the default product list page, adding Import and Export buttons in the header. The buttons open drawer routes at `/products/import` and `/products/export`.",
"files": [
{
"path": "product-import-export/workflows/steps/get-seller-products.ts",
diff --git a/packages/registry/src/product-import-export/api/vendor/products/import/route.ts b/packages/registry/src/product-import-export/api/vendor/products/import/route.ts
index 891a93df8..f9400a052 100644
--- a/packages/registry/src/product-import-export/api/vendor/products/import/route.ts
+++ b/packages/registry/src/product-import-export/api/vendor/products/import/route.ts
@@ -1,3 +1,4 @@
+import "multer"
import {
AuthenticatedMedusaRequest,
MedusaResponse,
diff --git a/templates/basic/.claude/skills/mercur-blocks/SKILL.md b/templates/basic/.claude/skills/mercur-blocks/SKILL.md
index 6623a6165..2f0883705 100644
--- a/templates/basic/.claude/skills/mercur-blocks/SKILL.md
+++ b/templates/basic/.claude/skills/mercur-blocks/SKILL.md
@@ -29,7 +29,7 @@ Think about block impact by alias destination, not just by name.
5. When CLI asks to overwrite `middlewares.ts` — **always decline** and merge manually.
6. Inspect the installed files and the block docs output.
7. Apply all configuration from the block docs (middleware, medusa-config, env vars, migrations).
-8. Run the smallest relevant verification set.
+8. Run `bun run dev` from `packages/api` and check for startup errors before moving on.
## Post-install checklist
diff --git a/templates/basic/packages/api/src/api/admin/custom/route.ts b/templates/basic/packages/api/src/api/admin/custom/route.ts
index 9e2e618c3..07888d8be 100644
--- a/templates/basic/packages/api/src/api/admin/custom/route.ts
+++ b/templates/basic/packages/api/src/api/admin/custom/route.ts
@@ -1,7 +1,7 @@
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http";
export async function GET(
- req: MedusaRequest,
+ _req: MedusaRequest,
res: MedusaResponse
) {
res.sendStatus(200);
diff --git a/templates/basic/packages/api/src/api/store/custom/route.ts b/templates/basic/packages/api/src/api/store/custom/route.ts
index 9e2e618c3..07888d8be 100644
--- a/templates/basic/packages/api/src/api/store/custom/route.ts
+++ b/templates/basic/packages/api/src/api/store/custom/route.ts
@@ -1,7 +1,7 @@
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http";
export async function GET(
- req: MedusaRequest,
+ _req: MedusaRequest,
res: MedusaResponse
) {
res.sendStatus(200);