Global Middleware
Can someone help me pls, what the hell i am doing wrong -.-.
import { createMiddleware, createStart } from '@tanstack/react-start'
import { getRequest } from '@tanstack/react-start/server'
export const loggingMiddleware = createMiddleware().server(async ({ next }) => {
const request = getRequest()
console.log('request', request.url, crypto.randomUUID())
return next()
})
export const startInstance = createStart(() => {
return {
requestMiddleware: [loggingMiddleware],
}
})
data
:
message
:
"Cannot read properties of undefined (reading 'push')"
name
:
"TypeError"
stack
:
"TypeError: Cannot read properties of undefined (reading 'push')\n at hydrateStart (http://localhost:5055/node_modules/@tanstack/start-client-core/dist/esm/client/hydrateStart.js?t=1762376760469&v=83b5ef28:19:25)"import { createMiddleware, createStart } from '@tanstack/react-start'
import { getRequest } from '@tanstack/react-start/server'
export const loggingMiddleware = createMiddleware().server(async ({ next }) => {
const request = getRequest()
console.log('request', request.url, crypto.randomUUID())
return next()
})
export const startInstance = createStart(() => {
return {
requestMiddleware: [loggingMiddleware],
}
})
data
:
message
:
"Cannot read properties of undefined (reading 'push')"
name
:
"TypeError"
stack
:
"TypeError: Cannot read properties of undefined (reading 'push')\n at hydrateStart (http://localhost:5055/node_modules/@tanstack/start-client-core/dist/esm/client/hydrateStart.js?t=1762376760469&v=83b5ef28:19:25)"