honox
honox copied to clipboard
Unable to use cookies through `hono/cookie`
What version of HonoX are you using?
0.1.23
What steps can reproduce the bug?
Case 1 - getCookie
import { getCookie } from 'hono/cookie'
const cookie = await getCookie(c, 'testCookie');
const test = !!cookie;
This error is thrown in the browser console:
Uncaught (in promise) TypeError: can't access property "raw", c.req is undefined
getSignedCookie index.js:25
which points to this line const cookie = c.req.raw.headers.get("Cookie");
Case 2 - getSignedCookie
const cookie = await getSignedCookie(c, c.env.KEY, 'testCookie');
const test = !!cookie;
In development, bun throws and exits with:
TypeError: Cannot read properties of undefined (reading 'raw')
at Module.getSignedCookie (/home/astra/Documents/database/honox-client/node_modules/hono/dist/helper/cookie/index.js:28:24)
Case 3 - setCookie
setCookie(c, 'testCookie', '1')
This throws:
Uncaught (in promise) TypeError: c.header is not a function
setCookie index.js:59
Which points to c.header("set-cookie", cookie, { append: true });
Case 4 - setSignedCookie
seSignedCookie(c, KEY, 'testCookie', '1')
bun
throws and exists with:
TypeError: c.header is not a function
at Module.setSignedCookie (/home/astra/Documents/database/honox-client/node_modules/hono/dist/helper/cookie/index.js:82:5)