It looks like the build is choking on the return that lives inside the template-string’s inline .map() callback.
Moving that logic outside the template (and adding a quick “'use server'” pragma) eliminates the “Illegal return statement” error.
This update:
• Adds 'use server' to both API routes
• Builds any multi-line text before the template literal, sidestepping the inline return that was triggering the “Illegal return statement” error.
Everything should now compile and run without that syntax error. ✅