Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug?]: project:sync is broken #8580

Closed
1 task done
arimendelow opened this issue Jun 10, 2023 · 30 comments
Closed
1 task done

[Bug?]: project:sync is broken #8580

arimendelow opened this issue Jun 10, 2023 · 30 comments
Labels
bug/needs-info More information is needed for reproduction

Comments

@arimendelow
Copy link
Contributor

What's not working?

Following the contribution instructions, I'm attempting to work on a Redwood package alongside my existing project. My project is fully up to date.

I'm running into a few fully breaking issues:

It flat out breaks my project

After I run the project:sync command, I see a successful output:

Screenshot 2023-06-09 at 5 10 59 PM

I then run yarn rw dev, but my project now has random breaking issues:

Screenshot 2023-06-09 at 5 12 09 PM

Sync is broken and crashes

I then tried to see if syncing even worked, so I went to the package that I want to work on (auth-providers/dbAuth), and added a simple console log just to see if it would sync. Doing that leads to project:sync crashing:

Screenshot 2023-06-09 at 5 13 37 PM

I've run git clean -fxd, yarn cache clean... it seems to be an issue with the project itself.

Am I doing something wrong?

Thanks!

How do we reproduce the bug?

No response

What's your environment? (If it applies)

No response

Are you interested in working on this?

  • I'm interested in working on this
@arimendelow arimendelow added the bug/needs-info More information is needed for reproduction label Jun 10, 2023
@arimendelow
Copy link
Contributor Author

I confirmed that the first issue (failed to execute 'createElement' on 'Document') is a problem with the canary, not the sync itself.

However, trying to run sync once I've upgraded my project to the canary now gives the following:

Screenshot 2023-06-09 at 5 32 20 PM

@jtoar
Copy link
Contributor

jtoar commented Jun 10, 2023

Hey @arimendelow, I'm actually working on that fixing that error here #8579. I think I have it fixed and discovered a few more things that weren't quite right with that script. There's still a few improvements I want to make, but I think it fixes the issue you're seeing. Could you confirm for me by pulling down that branch and running yarn rwfw project:sync from there?

@jtoar
Copy link
Contributor

jtoar commented Jun 10, 2023

@arimendelow and about the SVG change, yes that's one of the breaking changes we're working out for the next major. The change was in this PR: #8301, and WIP codemod here: #8564

@jtoar jtoar changed the title [Bug?]: project:sync is BROKEN [Bug?]: project:sync is broken Jun 10, 2023
@arimendelow
Copy link
Contributor Author

arimendelow commented Jun 10, 2023

@jtoar ahhh thanks for the quick reply! that SVG change is easy enough.

I pulled down and built your branch, and then after cleaning up both my project and the fw with git clean -fxd -e .env; yarn cache clean, I ran yarn rwfw project:sync - same error on attempt to sync. Should I be doing something differently?

@jtoar
Copy link
Contributor

jtoar commented Jun 10, 2023

@arimendelow No I don't think so, all the steps you mentioned seemed like enough. I'll just have to keep trying things to figure out what's going on. I'll post a short video soon showing what I'm doing just so you can double check

@arimendelow
Copy link
Contributor Author

@jtoar sounds good :)

@jtoar
Copy link
Contributor

jtoar commented Jun 10, 2023

@arimendelow A higher resolution is taking longer to process but here's what I'm doing (there's no audio, just a quick recording I did with Mac's screenshot utility): https://www.youtube.com/watch?v=0yLUZ2GhX-A

One thing I should've asked: what's your OS?

@jtoar
Copy link
Contributor

jtoar commented Jun 10, 2023

Also I'll add: sorry, I'm force pushing to that branch a lot which means if you want the new changes they're a little harder to get locally

@arimendelow
Copy link
Contributor Author

@jtoar thanks! that's pretty in line with what I was doing, I'll pull down your latest changes and report back.

macOS....whatever the latest is 😄

@arimendelow
Copy link
Contributor Author

lol yeah i was wondering what was going on there. no worries!

@arimendelow
Copy link
Contributor Author

@jtoar just tried with your latest changes, still have this issue.

are you able to make edits to DbAuthHandler in sync mode? maybe give that a try as a repro

@arimendelow
Copy link
Contributor Author

@jtoar is there a recommended workflow for working on the framework while you're working on this fix? cc @thedavidprice @cannikin if you have any suggestions :)

@cannikin
Copy link
Member

You could use project:copy instead...you'd have to do it every time there's a change in the framework though. :(

@arimendelow
Copy link
Contributor Author

yeah, i was thinking there'd be a command like that - better than nothing! is that what you've been doing?

@cannikin
Copy link
Member

Yeah there's been a couple of times when project:sync wouldn't work for me. I believe there's a --watch flag which makes it even better, it kind of acts like sync but isn't quite as fast!

@arimendelow
Copy link
Contributor Author

cool, thanks @cannikin! do you folks think there's an ETA on this fix or should I get used to using project:copy? 🙃

@thedavidprice
Copy link
Contributor

@arimendelow If you could try out this PR locally and provide feedback to @jtoar it would be very helpful! (no pressure, to be clear)
#8579

@arimendelow
Copy link
Contributor Author

@thedavidprice do you know if there have been meaningful updates to the PR since yesterday? as of yesterday, it still didn't work (see above)

@thedavidprice
Copy link
Contributor

@arimendelow just worked for me ✅

@arimendelow
Copy link
Contributor Author

@thedavidprice have you tried editing packages/auth-providers/dbAuth/api/src/DbAuthHandler.ts? I just tried with the latest changes (did git clean etc ofc) and I'm still getting the error out.

@thedavidprice
Copy link
Contributor

@arimendelow Gah, I just reproduced the error after editing the file. The first time I simply walked through the steps outlined in the PR. Great catch.

I've updated the review here:
#8579 (review)

@arimendelow
Copy link
Contributor Author

@thedavidprice thanks for the support 🙂 hurdle 1 of what I assume to be many on my journey to add OAuth to dbAuth!

@arimendelow
Copy link
Contributor Author

@jtoar @thedavidprice project:sync is now working perfectly for me, with one exception - whenever I make a change in a web-side file, I need to do a git clean and rebuild on the project side before it's reflected. Even project:copy didn't work for this.

Is that expected? It's quite annoying, but workable.

@jtoar
Copy link
Contributor

jtoar commented Jun 14, 2023

@arimendelow By web-side file, do you mean in your redwood project? Or in the @redwoodjs/web package? (Or any @redwoodjs package that eventually ends up on the web side?)

@arimendelow
Copy link
Contributor Author

It was specifically the web side auth stuff from the Redwood side

@arimendelow
Copy link
Contributor Author

The auth context provider, for example

@jtoar
Copy link
Contributor

jtoar commented Jun 14, 2023

Thanks @arimendelow I can reproduce that; the first change takes effect but not subsequent ones, even after re-starting the dev server. I'm guessing it has to do with Vite caching, but don't know for sure so I'll read up on it and ask the team.

@jtoar
Copy link
Contributor

jtoar commented Jun 14, 2023

@arimendelow so Vite node_modules caching is definitely a thing and it only re-bundles based on these events, which project:sync doesn't fall under:

  • Package manager lockfile content, e.g. package-lock.json, yarn.lock, pnpm-lock.yaml or bun.lockb.
  • Patches folder modification time.
  • Relevant fields in your vite.config.js, if present.
  • NODE_ENV value.

Source: https://vitejs.dev/guide/dep-pre-bundling.html#file-system-cache.

We'll figure out how to make this easier, but for now this should save you from having to do a git clean and rebuild. Start your dev server like this:

yarn rw dev --forward="--force"

Make sure you see this in your terminal:

web | Forced re-optimization of dependencies

You'll have to restart your dev server every time you make a change, but it'll be much faster than a full git clean and rebuild.

@arimendelow
Copy link
Contributor Author

ahhhh yup makes sense - the workaround works great, thanks @jtoar! :)

@arimendelow
Copy link
Contributor Author

I'll close this bug as I feel your PR fixed it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/needs-info More information is needed for reproduction
Projects
None yet
Development

No branches or pull requests

4 participants