My background function in nextjs logs the following but not any of the console logs
Jan 22, 12:28:18 PM: fc4312f0 INFO [POST] /api/notif-classic-background (API)Jan 22, 12:28:18 PM: fc4312f0 Duration: 2602.24 ms Memory Usage: 176 MB
netlify.toml file
[functions."notif-classic-background"]
included_files = [
"src/program-sdks/amm/idl/**",
"src/pages/api/utils/constants.ts"
]
external_node_modules = [
"@dialectlabs/blockchain-sdk-solana",
"@dialectlabs/react-sdk-blockchain-solana",
"@dialectlabs/sdk",
"@project-serum/anchor",
"@solana/spl-token",
"@solana/wallet-adapter-base",
"@solana/web3.js",
"axios",
"bs58",
"zod"
]
node_bundler = "esbuild"
timout = '30s'
src/pages/api/notif-classic-background.ts
export const config = {
type: 'experimental-background',
};
export default async function handler(
req: NextApiRequest,
res: NextApiResponse,
) {
try {
console.log('In handler');
switch (req.method) {
case 'GET':
return handleGet(req, res);
case 'POST':
return handlePost(req, res);
case 'OPTIONS':
return handleOptions(res);
}
} catch (error) {
console.log('ERROR', error);
return res.status(400).json({ message: 'Something went wrong.' });
}
}
site is using ‘next’ version 13.4.8