Skip to content

[Bug]: Draft order edits using Secret api key #13859

@pavelstianko

Description

@pavelstianko

Package.json file

"dependencies": {
    "@medusajs/admin-sdk": "2.11.0",
    "@medusajs/cli": "2.11.0",
    "@medusajs/framework": "2.11.0",
    "@medusajs/medusa": "2.11.0",
    "@mikro-orm/core": "6.4.16",
    "@mikro-orm/knex": "6.4.16",
    "@mikro-orm/migrations": "6.4.16",
    "@mikro-orm/postgresql": "6.4.16",
    "awilix": "^8.0.1",
    "pg": "^8.16.3"
  },

Node.js version

v22.17.0

Database and its version

postgres:15

Operating system name and version

Macos

Browser name

No response

What happended?

When editing a draft order via the endpoint /admin/draft-orders/{{draft-order-id}} using a secret API key, the system incorrectly assigns the API key ID (apk_****) as the user id of the edit.

Expected behavior

The edit should be associated with a valid admin user, allowing the draft order to be viewed normally in the admin interface.

Actual behavior

When opening the draft order, you get a 404 error and the following message:
FetchError: User with id: apk_**** was not found

Link to reproduction repo

https://github.com/medusajs/medusa

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions