fix: initiate request container before other express middleware (#12761)
This commit is contained in:
@@ -89,10 +89,10 @@ async function loadEntrypoints(
|
||||
return async () => {}
|
||||
}
|
||||
|
||||
const { shutdown } = await expressLoader({
|
||||
app: expressApp,
|
||||
})
|
||||
|
||||
/**
|
||||
* The scope and the ip address must be fetched before we execute any other
|
||||
* middleware
|
||||
*/
|
||||
expressApp.use((req: Request, res: Response, next: NextFunction) => {
|
||||
req.scope = container.createScope() as MedusaContainer
|
||||
req.requestId = (req.headers["x-request-id"] as string) ?? v4()
|
||||
@@ -108,6 +108,10 @@ async function loadEntrypoints(
|
||||
next()
|
||||
})
|
||||
|
||||
const { shutdown } = await expressLoader({
|
||||
app: expressApp,
|
||||
})
|
||||
|
||||
await adminLoader({ app: expressApp, configModule, rootDirectory, plugins })
|
||||
await apiLoader({
|
||||
container,
|
||||
|
||||
Reference in New Issue
Block a user