Fetch requests to API endpoints aren't showing the session

Last edited: 1/18/2025

You must pass along the cookie header with the fetch request in order for your API endpoint to get access to the cookie from this request.

1
const res = await fetch('http://localhost:3000/contact', {
2
headers: {
3
cookie: headers().get('cookie') as string,
4
},
5
})