codesandbox / codesandbox-client

An online IDE for rapid web development
https://codesandbox.io
Other
13.08k stars 2.28k forks source link

Problem saving the code / Failed to save [file]: Unknown Save Error - Sentry exception #5540

Open leoncvlt opened 3 years ago

leoncvlt commented 3 years ago

🐛 bug report

Preflight Checklist

Description of the problem

Upon saving a file, I get two notification on the bottom right:

Seems to be a problem with sentry, the network tab shows a failed request to sentry.io on save, with the response carrying the exception "Non-Error exception captured with keys: reason"

On top of that, the developer console displays the following errors on attempting to save:

This only happens in one file, the rest of the files in the sandbox work and save fine.

How has this issue affected you? What are you trying to accomplish?

The file is forever marked in an "unsaved" state. Worth mentioning that even with the errors above, the file seems to save fine for my user as opening the sandbox in a different browser / incognito mode shows the latest edits, however when accessing the sandbox via a public link the file appears empty.

To Reproduce

To be honest, I have no idea. it just started happening out of the blue, for just one file in one sandbox.

Your Environment

Software Name/Version
Сodesandbox 76fd74d21
Browser Chrome Version 88.0.4324.190 (Official Build) (64-bit) / Firefox 86.0 (64-bit)
Operating System Windows 10
leoncvlt commented 3 years ago

FYI the file now saves fine after opening the sandbox a day later, although all the content / edits have been lost (luckily I had saved a local backup when I noticed the issue).

CompuIves commented 3 years ago

Hey! I'm looking into this, I have a hunch on what it might be. I'm wondering when you tried to save the file, did you try to save the file right before forking?

CompuIves commented 3 years ago

Another thing that might be the cause, did you paste into DialogueParser.js right before saving?

leoncvlt commented 3 years ago

Hey! I'm looking into this, I have a hunch on what it might be. I'm wondering when you tried to save the file, did you try to save the file right before forking?

Thank you - yes, this morning I opened the sandbox, found the DialogueParser.js was empty, copied and pasted the code had I made a backup of, saved it (with no issues), then played around a bit to make sure the sandbox was working fine. After a while I made the sandbox into a github sandbox.

Yesterday I kept getting the issues every time I tried saving, right from when creating the file (the file did "save" during my session as I could see the changes in codesandbox's browser view, but I guess it never really saved to disk / persistent storage, hence why me finding the file empty when going back to it this morning).

Another thing that might be the cause, did you paste into DialogueParser.js right before saving?

I definitely did some copy and paste while writing the file but I don't remember if I first attempted to save right after pasting, sorry.

JohnAnon9771 commented 3 years ago

Same problem here... Sometimes it doesn't even show the error, it just doesn't want to save. :cry:

drfbwilliams commented 3 years ago

Hi - looks like I just lost about 3 days of work.... during a week where I need a live demo on Monday.

Saving stuff is a core tenant of how the solution should work - may I suggest your team drops everything else and actually gets this part right. Until then, the product is not suitable for production work and unfortunately until it is, I am unable to authorise a subscription for it.

Here is an image of what is being shown:

image

If it helps - I had two sandboxes open at the time and used one to derive the other from. Both sandboxes have failed to save their files. Clicking save on the file results in the image above.

I like the product a lot - I want my teams to use it. This failure is brutal though and just not sure where we go from here.

If you would like a link to the sandbox, I shall provide.

Best of luck resolving this issue.

CompuIves commented 3 years ago

Indeed very important @drfbwilliams, I disabled the feature that causes this when I saw your issue and that it hasn't been resolved yet and I'm looking into what's causing this. It's very tricky, at some point there's a race condition which gets you in a state where saving is impossible. I now have more data that I can use to look more closely into this though, I'll report back when I have a proper fix.

kilianso commented 3 years ago

Hey folks. Same issue here.

I'm running a remote coding course using Codesandbox and participants invited me as an editor to their projects. If I try to change and save any of the files, two notifications appear on the bottom right corner:

There was a problem with saving the code, please try again

The code was out of sync with the server, we had to reset the file

Unknown save error

The second one is also appearing in the console.

I tried different browsers and double-checked if I have the rights to edit. It seems all good, nevertheless, I cannot edit any of the projects of the course participants. We are building something really simple based on the "static" template.

Sometimes people are not even able to save their own files all of the sudden, and then some time later it just works again. It's strange and really hard to reproduce.

drfbwilliams commented 3 years ago

@CompuIves Hi Ives,

I've just run a series of updates in the sandboxes that were failing and I am please to report that the save all mechanism appears to be working correctly with updated thumb nails in the dashboard as well.

I also note an improvement on the transpiling of Modules which previously would simply get stuck on module 1 - that appears to have been fixed as well.

I'm unsure if others are still seeing issues, but from my issue I am pleased to confirm a resolution.

Many thanks. Best, Brennon

lbogdan commented 3 years ago

@leoncvlt @JohnAnon9771 @kilianso Have you still been experiencing this issue lately?

drfbwilliams commented 3 years ago

Hey - I'm not sure if its related, but in some instances I was seeing that new files with changes just wouldnt save updates until I went back to the dashboard and then opened the sandbox again. I haven't seen that error specifically again since confirming that it was fixed.

While I'm here - that prettier module just creates a mess on save - it actually changes the formatting to such a degree to remove brackets etc. It would be nice to just switch that bad boy off.

Cheers

lbogdan commented 3 years ago

@drfbwilliams You can turn it off as described here, and also for forks, as described here.

If you were referring to the default setting, then yeah, we should probably consider it.

drfbwilliams commented 3 years ago

@lbogdan - thanks for that info.

With reference to consider turning it off by default - reach out to your users and ask them the question - that gives you the answer nice and clear ;-)

I hate it - but most of your customers might love it by default, so it should stay etc.

sbinlondon commented 3 years ago

@kilianso Hey there I wanted to see if you could provide some more info and ask if you're still having this problem?

When you say invite as an editor, were you joining them in a live collaboration session or were you just opening their sandbox, not simultaneously, and trying to make changes? Did they fork their sandboxes from one you made?

If you're able to link to some of the sandboxes that would be really helpful! 😊

FossPrime commented 2 years ago

I've experienced this issue before, but while refactoring some code to upgrade a few modules my SSE server will spend a lot of time recompiling and not entering a success state for a long time. When that's happening I'll constantly get this error, I've resorted to creating a dummy successful command in package.json while refactoring.

taito9000 commented 2 years ago

After I logged in again I could have saved files.