After update to Nextjs 12.1.0, when I call api via api route, the following error is returned. I'm using aws amplify.

The following error is returned in the CloudFront console:

My api route:
const handlerProducts = async (req: NextApiRequest, res:NextApiResponse) => {
const params = req.query;
try {
const { data } = await axios.get(URL, {
params,
});
res.status(200).send(data);
} catch (err: any) {
res.status(500).end();
}};
What could be causing this problem? Thanks for all the help.