Open bradystroud opened 2 years ago
This is a becoming a major issue and makes it almost pointless using Netlify CMS.
This was so painful. Please fix the problem.... or improve that error message please π’
The solution for me was: Github.com | My Profile | Your repositories | Select the forked repo eg. SSW.Rules.Content Click Fetch upstream Click Fetch and merge
Note: This updates my fork to be usable. When I went back to my edit, I refresh and lost my changes. So I re-did
-a www.adamcogan.com
Hi all and thank you for reporting the issue.
It seems there's a new API to sync forks, see https://docs.github.com/en/rest/reference/branches#sync-a-fork-branch-with-the-upstream-repository
As I'm understanding the issue correctly, we should call that API before saving entries to resolve the issue? If so, would anyone be open to contribute this fix?
cc: @JackDevAU Thanks @erezrokah π, as we aren't familiar with the codebase, could you provide some insight on where this change will need to be added?
Sure @bradystroud, the relevant code is here: https://github.com/netlify/netlify-cms/blob/7bd80b29a43943e5e01a0d7c75573ce02c97f9a3/packages/netlify-cms-backend-github/src/implementation.tsx#L286
We can use the forkExists
check and sync the repo if the condition is true.
We can probably optimize that code to not call the forks
API too
@erezrokah are you looking for something like this?
async authenticateWithFork({
userData,
getPermissionToFork,
}: {
userData: User;
getPermissionToFork: () => Promise<boolean> | boolean;
}) {
// ...rest of the code for authenticateWithFork
if (await this.forkExists({ token })) {
return fetch(`${this.apiRoot}/repos/${userData.login}/${this.originRepo}/merge-upstream`, {
method: 'POST',
headers: {
Authorization: `token ${token}`,
},
body: JSON.stringify({
branch: this.branch,
}),
});
} else {
await getPermissionToFork();
const fork = await fetch(`${this.apiRoot}/repos/${this.originRepo}/forks`, {
method: 'POST',
headers: {
Authorization: `token ${token}`,
},
}).then(res => res.json());
this.useOpenAuthoring = true;
this.repo = fork.full_name;
return this.pollUntilForkExists({ repo: fork.full_name, token });
}
}
I am also seeing this typescript error down the file, not sure what to make of it:
Hey @asheerrizvi Looks good - Go ahead and create a PR π
Here's the PR, let me know if you guys need any changes: #6504
@erezrokah @bradystroud
π
ping: needs to be resolved.
This is a huge cause of pain for us, @martinjagodic could you please review and action the PR from @asheerrizvi
We are aware of this problem, we will take a look at the PR soon after we establish the first Decap release. Thanks for your patience π
Ping... what is the status of this one? -a www.adamcogan.com
Definitely not fixed - had the same issue a few times recently :(
Have seen this issue come up many times recently. Would love to have this resolved!
This issue is in our attention. We are waiting for the PR owner to solve merge conflicts. If he doesn't respond we will do that on a new PR.
ping: any updates on this?
The PR is in progress, more details are there. In essence, builds are failing and I was struggling to create a good repoduction. I hope to find some time soon to continue with this.
Any help with the PR would speed things up.
This is now released in 3.1.0-beta.1. Can anyone test and confirm that this is solved?
@RMunschie92 @sethdailyssw @JeanThirion @adamcogan @pierssinclairssw @airtonix
Can't tell if its fixed because there is a new bug
I still get the error when clicking 'save' after I've made a change, see screenshot: Figure: Same error
I am still having the same issue on save. It has been 2 years... It's so painful... π
@bradystroud I see that many of you are from SSW. Could you find some time together to contribute?
Up, is there any update on this issue ?
not really I'm afraid
I'm willing to put some effort into this if we find a hero who would describe a very specific scenario on how to (somewhat consistently) reproduce this issue (maybe with a public repo?)
@demshy Commenting as I had several people I know report the same thing. Somehow it got resolved by deleting and re-inviting the user in Netlify identity. Willing to help with testing but can't consistently reproduce it. However, it's a major blocker when it happens..
cc: @jackDevAu @pierssinclairssw
Hi,
Describe the bug Some of our users are getting an error when they try to save an entry.
Failed to persist entry: API_ERROR: Not Found
Figure: Error when saving
After some investigation, it looks like the error occurs when Netlify CMS tries to compare the cms changes branch on the users fork with the main branch on the base repository. e.g.
https://api.github.com/repos/SSWConsulting/SSW.Rules.Content/compare/main...JackDevAU:cms/JackDevAU/SSW.Rules.Content/rule/appointments-do-you-show-all-the-necessary-information-in-the-subject/rule
the
JackDevAU:cms/JackDevAU/SSW.Rules.Content/rule/appointments-do-you-show-all-the-necessary-information-in-the-subject/rule
branch was not created. It is not clear why (see video). The results are the same when using an incoginto window in a different browser.The problem is resolved after updating the users fork. To try reproduce the problem, we reverted a fork to an old commit, then made a change, but the entry still saved.
To Reproduce We cannot consistently reproduce this error as it is only happening to some of our users. See our video attached below demoing the problem.
Expected behavior The entry should save without error.
Applicable Versions:
CMS configuration https://github.com/SSWConsulting/SSW.Rules/blob/main/src/cms/config.js
Additional context https://github.com/SSWConsulting/SSW.Rules/issues/801
https://user-images.githubusercontent.com/38869720/148888815-fba3ec44-c978-45a0-8f3f-d3e99713ef13.mp4
Figure: Demo of the error