Undefined 'sendRequest' error in Email Sending Functionality using Workers - Potential Issue with Of

I have been working on replicating the email sending functionality using workers, as detailed in the official blog. While transcribing the provided code snippet and running it in the worker, I've encountered an error stating that 'sendRequest' is undefined. Attached is the code snippet from the official blog (https://blog.cloudflare.com/sending-email-from-workers-with-mailchannels/https://blog.cloudflare.com/sending-email-from-workers-with-mailchannels/).
Upon checking the code, I noticed that the 'sendRequest' function was not preceded by the 'const' keyword. I am unsure whether this omission could be the root cause of the issue, or whether there may be another underlying problem that I might be overlooking.

Could you please clarify whether the code example given in the blog is complete, or if there could possibly be an error within the example? If the example is correct, is there something I might be doing incorrectly that's causing the error?
Screenshot_2023-07-08_at_01.43.06.png
Was this page helpful?