Ky.js not working on server action
Unanswered
Hepatic Tanager posted this in #help-forum
Hepatic TanagerOP
Using nextjs 15, Ky doesn't work and throws
On dev build (
what im missing here?
const payload: {
//.. some simple data
}
// Fetch works
const res = await fetch(apiLink, {
method: "POST",
body: JSON.stringify(payload),
headers: {
"Content-Type": "application/json",
"Accept": "/",
}
})
// Ky throws failed to fetch
const res = await ky.post(apiLink, {
headers: {
"Content-Type": "application/json",
"Accept": "/",
},
json: payload
});
error:TypeError: fetch failed
On dev build (
pnpm run dev
) works fine...what im missing here?
const payload: {
//.. some simple data
}
// Fetch works
const res = await fetch(apiLink, {
method: "POST",
body: JSON.stringify(payload),
headers: {
"Content-Type": "application/json",
"Accept": "/",
}
})
// Ky throws failed to fetch
const res = await ky.post(apiLink, {
headers: {
"Content-Type": "application/json",
"Accept": "/",
},
json: payload
});
1 Reply
Hepatic TanagerOP
Uppp