Skip to content

Custom PageContext returns undefined for all custom values #1537

@alycda

Description

@alycda

Description

Hi, I have followed the guides at https://vike.dev/pageContext#custom but the values I pass are ALWAYS undefined, server-side and client-side.

...
import cookieParser from 'cookie-parser'
...

  const app = express()

  app.use(compression())
  app.use(cookieParser())

...

    const pageContextInit = {
      urlOriginal: req.originalUrl,

      // pageContext.headers – e.g. make cookies available over pageContext.headers.cookies
      headers: req.headers,

      cookies: req.cookies,
    }

// +config.ts

export default {
  passToClient: [
    'headers',
    'cookies',
  ]
}

terminal console output for headers and cookies is undefined, as well as the console output in Browser DevTools. I have also tried adding a hardcoded string value and that also returns undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions