#MessageChannel is not defined

1 messages · Page 1 of 1 (latest)

wild knot
#

Using next.js 15 and react 19. I was trying to set up Convex auth -- email + password, and with one-time password sent to the user's email with Resend for verification. I followed the docs and basically copied the relevant components and files from the demo Convex auth project on github.

When I enter my email and password, and click 'sign up', I get this error [CONVEX A(auth:signIn)] Uncaught ReferenceError: MessageChannel is not defined. I should say that 'plain auth'--no OTP or emails sent to the user--works fine, but this one does not. @foggy bramble sorry to be tagging you but I thought you might be a good fit for an insight here because I saw your comment about polyfilling MessageChannel in a thread on issues in react/email from last week

foggy bramble
#

Yeah, did you try polyfilling

#

That's generally from running react on the server for rendering emails

wild knot
foggy bramble
#

no you're close, one sec

#

If you're getting the error about renderToPipeableStream (not readable), you're running react email in node, so you just need to externalize a dependency as mentioned in that linked comment

wild knot
#

wouldn't it perhaps make more sense to write up the steps for fixing this on in some nextjs section of docs on convex? Your nextjs quickstart docs suggest running npx create-next-app@latest my-app, which will install nextjs15 and react 19 by default. This means everyone going with nextjs + convex who also tries using convex auth (or at least the parts that involve sending emails, which is most) will run into this issue

foggy bramble
#

I should clarify, I'm not a team member. But yeah, you're not wrong on this, just has only come up so much, and this fix is pretty awful, really. My recommendation would be use node so you only have to externalize the react email dependency. Although I'm a bit confused that you got the MessageChannel error, which should only happen in the convex runtime, and then the pipeable stream error, which should only happen in node. Did you change runtimes?

wild knot
#

oh my bad, I didn't know you're not a team member. Yeah I was trying some other things; with just the MessageChannel polyfill, I get a readable stream error (whihc I think you addressed elsewhere). I'll probably stay off convex auth for the time being and go with clerk

vivid spindle
#

im getting this error while trying to use resendOTP, with react-mail