I am building a Next JS app. The Next JS version I am using is ^13.4.19
. I have a an API route with the following code (the filepath is src/pages/api/test.ts
).
const testRoute = async(req: NextApiRequest, res: NextApiResponse) => {
res.status(200).json({
message: "testing",
});
};
export default testRoute;
When I was on accessing the route locally, it was working as expected. Then after I deploy it to the server (I am using Serverless Stack - SST), it does not return any content. Instead I am just seeing the blank page.
This is the request info
when I access the route in the postman, I am getting 200 status code. But still empty response/ blank page.
I also tried changing the next js config not to generate Etag like this in next.config.js like this.
api: {
generateEtags: false,
},
generateEtags: false,
But it's not working. What is wrong with my code and how can I fix it?