Unable to set cookies in hooks

I'm not able to set normal or signed cookies in hooks.
hooks: {
before: createAuthMiddleware(async (ctx) => {
ctx.setCookies(
'cookie-name',
'test'
)
}),
hooks: {
before: createAuthMiddleware(async (ctx) => {
ctx.setCookies(
'cookie-name',
'test'
)
}),
ctx.setCookies return # SERVER_ERROR: TypeError: ctx.setCookies is not a function When i set a signed one, there is no error, but no cookie is actually set., but i do get an error that ctx.getSignedCookies is not a function when trying to read the signed cookie.
2 Replies
srd
srdOP4d ago
No description
srd
srdOP4d ago
its a typo in the doc, its not supposed to be plural. it also looks like its only possible to set cookies in the after hoook

Did you find this page helpful?