workers-sdk
workers-sdk copied to clipboard
🐛 BUG: wrangler logs success for pages deploy even with Functions failures
Which Cloudflare product(s) does this pertain to?
Wrangler core
What version(s) of the tool(s) are you using?
3.8.0
What version of Node are you using?
18.17.1
What operating system are you using?
Windows 10
Describe the Bug
When publishing a Pages project with Functions, wrangler will seemingly always report a success, even if the Functions upload fails.
Example:
index.html:
<html>
<body>
<h1>Hello World</h1>
</body>
</html>
functions/_middleware.js:
const a = true;
a();
export function onRequest(context){
return context.next()
}
Result via wrangler (npx [email protected] pages deploy .):
✨ Successfully created the 'test-functions-errors' project.
✨ Compiled Worker successfully
🌏 Uploading... (1/1)
✨ Success! Uploaded 1 files (1.56 sec)
✨ Uploading Functions bundle
✨ Deployment complete! Take a peek over at https://3f676375.test-functions-errors.pages.dev
But the Cloudflare Pages dashboard shows an error:
And the project isn't actually available. There's no way to get logs about what happened here, so folks are left confused.
This happens periodically in Discord, requiring a Pages team member to pull logs for a deployment ID, as well as on the forum such as at https://community.cloudflare.com/t/wrangler-pages-publish-always-fails-tried-both-with-nextjs-and-with-astro-templates/554749?u=cherryjimbo.