Skip to content

Vendor Creation Error #44

@Sr52-tech

Description

@Sr52-tech

I’m trying to build a market place and was following the recipe from the docs everything was going smoothly until the creation of vendor API route (step 5), in the testing part I was able to retrieve the token wen I signed up a vendor

curl -X POST 'http://localhost:9000/auth/vendor/emailpass/register' \
-H 'Content-Type: application/json' \
--data-raw '{
  "email": "vendor2@exampl.com",
  "password": "supersecret"
}'
{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY3Rvcl9pZCI6IiIsImFjdG9yX3R5cGUiOiJ2ZW5kb3IiLCJhdXRoX2lkZW50aXR5X2lkIjoiYXV0aGlkXzAxSlExQjdHSFM1RENTOTNTUEpFUUhRM1pKIiwiYXBwX21ldGFkYXRhIjp7fSwiaWF0IjoxNzQyNzI4MzE1LCJleHAiOjE3NDI4MTQ3MTV9.xzGQg_N76NGrnipcJ2SJTpKZq713amxKm7StmAN5caU”}

But, when I tried to send a request to the /vendors API route (tried to unwrap the token)

curl -X POST 'http://localhost:9000/vendors' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY3Rvcl9pZCI6IiIsImFjdG9yX3R5cGUiOiJ2ZW5kb3IiLCJhdXRoX2lkZW50aXR5X2lkIjoiYXV0aGlkXzAxSlExQjdHSFM1RENTOTNTUEpFUUhRM1pKIiwiYXBwX21ldGFkYXRhIjp7fSwiaWF0IjoxNzQyNzI4MzE1LCJleHAiOjE3NDI4MTQ3MTV9.xzGQg_N76NGrnipcJ2SJTpKZq713amxKm7StmAN5caU' \
--data-raw '{
  "name": "Acme",
  "handle": "acme",
  "admin": {
      "email": "vendor2@example.com",
      "first_name": "Admin",
      "last_name": "Acme"
  }
}'
{"code":"unknown_error","type":"unknown_error","message":"An unknown error occurred."}curl: (3) URL rejected: Malformed input to a URL function
zsh: command not found: --data-raw

And this is the full error

error:   Cannot read properties of undefined (reading 'auth_identity_id')
TypeError: Cannot read properties of undefined (reading 'auth_identity_id')
    at POST (/Users/shahad/Desktop/iStore/medusa/src/api/vendors/route.ts:44:42)
    at POST (/Users/shahad/Desktop/iStore/medusa/node_modules/@medusajs/framework/src/http/utils/wrap-handler.ts:27:20)
    at Layer.handle [as handle_request] (/Users/shahad/Desktop/iStore/medusa/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/shahad/Desktop/iStore/medusa/node_modules/express/lib/router/route.js:149:13)
    at Route.dispatch (/Users/shahad/Desktop/iStore/medusa/node_modules/express/lib/router/route.js:119:3)
    at Layer.handle [as handle_request] (/Users/shahad/Desktop/iStore/medusa/node_modules/express/lib/router/layer.js:95:5)
    at /Users/shahad/Desktop/iStore/medusa/node_modules/express/lib/router/index.js:284:15
    at Function.process_params (/Users/shahad/Desktop/iStore/medusa/node_modules/express/lib/router/index.js:346:12)
    at next (/Users/shahad/Desktop/iStore/medusa/node_modules/express/lib/router/index.js:280:10)
    at urlencodedParser (/Users/shahad/Desktop/iStore/medusa/node_modules/body-parser/lib/types/urlencoded.js:94:7)

Node: v22.14.0
Medusa js: 2.6.1
OS: macOS Ventura
following: https://docs.medusajs.com/resources/recipes/marketplace/examples/vendors#step-5-create-vendor-api-route (step 5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions