I am trying to do a simple GET call (select * from …).
I get the following error: “GET
http://localhost:8888/.netlify/functions/select
[HTTP/1.1 431 Request Header Fields Too Large 1323ms]”.
I have the function select.tsx function file in the node_modules/@netlify/functions folder.
The fetch request that I’m using is:
fetch(
'/.netlify/functions/select', {
method: 'GET',
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
},
})
.then((res) => {
//console.log("No GET error!")
console.log(res)
})
.catch((err) => console.log(err))
}
I have tried using:
‘’/.netlify/functions/select’,
‘/@netlify/functions/select’,
‘.netlify/functions/select’, and
‘@netlify/functions/select’.
The function looks like this:
const handler: Handler = withPlanetscale(async (event, context) => {
const {
planetscale: { connection },
} = context;
console.log('MADE IT INSIDE!')
const { body } = event;
return connection.execute('select * from Todo')
.then((res) => {
return {
statusCode: 201,
body: JSON.stringify(res),
};
})
.catch((err) => ({
statusCode: 400,
body: JSON.stringify(err),
})
)
});
export { handler };