I have a very basic test background function in nextjs which returns the 20x status code but never runs the actual function (nothing in logs nothing posted to other services).
This all works when I’m running locally with netlify dev
I’m a pro customer (not free, so background functions should be enabled). This is happening in a couple repos, one on next12 and one on next13. It’s been happening for at least 10 days so far.
Welcome to the Netlify Forums and thanks for reaching out! We have shared this with our teams internally and will follow up with you here once we know more. Thanks for your patience!
To post an update (which has also been shared in the helpdesk), this appears to be a bug with the Next.js Runtime. For anyone willing to use Background Functions, you can use it by using standard Netlify Background Functions instead of Next.js API routes. The fix for the bug is still being investigated.
Any (recent) Next.js version should work fine. However, if you’re talking specifically about Background Functions not working, that’s not even a Next.js feature. That’s a Netlify-specific add-on, and it’s currently having some issues - as you’ve noticed. It should be fixed soon.
If you’re having some other issues with Next.js on Netlify, feel free to let us know.
Could you confirm if you were accessing the URL as /api/<route-name> and not /.netlify/functions/? The former should work as a background/scheduled function, the latter would not. We’re working on improving this so it can be more obvious in the future.