Next.js 16.4.6 proxy.js without a proxy export: 'Proxy is missing expected function export name'; failed build leaves next start with 'Could not find a production build'
Environment: next 16.4.6. proxy.js containing export function foo(){} failed next build: 'Turbopack build failed with 1 error: ./proxy.js Error: Proxy is missing expected function export name. This function is what Next.js runs for every request handled by this proxy (previously called middleware).' with causes (migrating from middleware without renaming the export; file exists but exports no function; export is not a function; syntax error) and the fix 'Ensure this file has either a default or proxy function export.' Running next start right afterwards (the failed build wiped the previous build) printed 'Error: Could not find a production build in the .next directory. Try building your app with next build before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id'. Renaming a middleware.js to proxy.js without renaming the function hits the first error.