redwood: [Bug?]: Redwood Studio can't load email templates (SWC)
What’s not working?
Due to some issue of filesystem access in the swc library, Redwood Studio can’t dynamically load my React Email templates.
The error stack is this:
Error updating mailer and mail templates:
Error: Fallback bindings does not support filesystem access
at Compiler.parseFileSync (my_dir/node_modules/@redwoodjs/studio/node_modules/@swc/core/index.js:163:19)
at Object.parseFileSync (my_dir/node_modules/@redwoodjs/studio/node_modules/@swc/core/index.js:332:21)
at getMailTemplateComponents (my_dir/node_modules/@redwoodjs/studio/dist/api/mail/index.js:206:19)
at updateMailTemplates
How do we reproduce the bug?
- new redwood build on 6.4.2
- setup mailer
- add React Email configuration
- start Redwood Studio
What’s your environment? (If it applies)
System:
OS: macOS 14.0
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.2.0 - /private/var/folders/vf/nj_jbnqs6s97151rx0vf36zh0000gn/T/xfs-36609f3c/node
Yarn: 3.5.0 - /private/var/folders/vf/nj_jbnqs6s97151rx0vf36zh0000gn/T/xfs-36609f3c/yarn
Databases:
SQLite: 3.39.5 - /usr/bin/sqlite3
Browsers:
Chrome: 119.0.6045.199
Safari: 17.0
npmPackages:
@redwoodjs/auth-auth0-setup: 6.4.2 => 6.4.2
@redwoodjs/cli-storybook: 6.4.2 => 6.4.2
@redwoodjs/core: 6.4.2 => 6.4.2
@redwoodjs/studio: 6.4.2 => 6.4.2
Are you interested in working on this?
- I’m interested in working on this
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Comments: 18 (12 by maintainers)
Commits related to this issue
- #9620: Update studio to support variable components (Mailer) — committed to raph90/redwood by raph90 7 months ago
- #9620: Update studio to support variable components (Mailer) — committed to raph90/redwood by raph90 7 months ago
- #9620: Update studio to support variable components (Mailer) — committed to raph90/redwood by raph90 7 months ago
- #9620: Update studio to support variable components (Mailer) — committed to raph90/redwood by raph90 7 months ago
- #9620: Update studio to support variable components (Mailer) (#9639) Reference to #9620. Currently Studio supports `export function Welcome()` syntax for emails. This PR adds support for `export... — committed to redwoodjs/redwood by raph90 6 months ago
- Merge branch 'fix/enhance-error-apollo-suspense' of github.com:dac09/redwood into fix/enhance-error-apollo-suspense * 'fix/enhance-error-apollo-suspense' of github.com:dac09/redwood: (92 commits) c... — committed to dac09/redwood by dac09 6 months ago
- Merge branch 'main' of github.com:redwoodjs/redwood into fix/module-path-aliases * 'main' of github.com:redwoodjs/redwood: (92 commits) chore(deps): update dependency @types/yargs to v17.0.32 (#975... — committed to dac09/redwood by dac09 6 months ago
- #9620: Update studio to support variable components (Mailer) (#9639) Reference to #9620. Currently Studio supports `export function Welcome()` syntax for emails. This PR adds support for `export... — committed to redwoodjs/redwood by raph90 6 months ago
That’s perfect @raph90. I’ll find some time to review this again today or tomorrow. We can have this merged soon for sure!
For some context, the studio package isn’t representative of the rest of the framework. I quickly created it as an experimental feature so it wasn’t built to the same standard as the rest of our packages. Over the new year we’ll be transitioning the studio to its own repository built with redwood itself. This should fix these sorts of configuration issues so I’d feel bad making anyone else sink lots of time into fixing these chores.
Hi @Josh-Walker-GM, I’m afraid I don’t think I’d be able to get round to a PR for this at the moment - but very happy to talk through stuff here, since I would really love to start contributing to RW.
Can all those platform specific dependencies go in as optional dependencies or are they already treated like that? - Yes I think they can, the SO post where I found that solution used npm -optional (I think) and I wasn’t sure of the yarn equivalent
Yeah I’m not sure what the issue is here - I’m pretty sure I did everything correctly / downloaded the correct packages.
As an additional question - if you wanted to debug / breakpoint through Studio, what would be the correct way to do that? Would you have a launch.json for VS Code that you might be able to share? Or is just logging the way do you think?
I tried loading up redwood and doing the RWFW command on my project, but I wasn’t able to get any breakpoints to catch in the api/mail code.
No worries about the write up, many thanks for looking into this!
Thanks for providing such detail @raph90!
Sorry I haven’t gotten to this sooner. My initial reaction to your points are:
If you’d like to make a PR for this then I’d be more than happy to help out with it and review it. I do hope to spend some time on this tomorrow and if I get to the bottom of it I’ll likely make a PR. I can leave it and give you a few days to tackle this one too if you’d like but if you could let me know in the next day then that would be great.
Thanks again for the details it’s really great when people take the time to document things as clearly as you have, awesome!