Revert not authorised!
We are attempting to revert some commits using the our admin user but it asks us to login. When we login using the admin user it says unauthorised.
We are using version 3.6.2 hosted on an AWS EC2 instance.
It looks like a version control bug. Is it possible for you to email me your data so we can analyze whats wrong?
I have emailed you the data.
@jan_blaha have you managed to take a look with the data I sent?
@rchristiemtt hi! I investigated the problem, let me explain a bit what is happening
the login prompt appears when we detect there is an authorization error when executing code, we detected that we also throw such authorization error when we detect some inconsistency in the data stored (if you are curious, the mentioned error is thrown here), such inconsistency in your case is that the data that the version control has contains some invalid references to folders, basically, the entities in the commits are contained by folders (more specifically folders shortid) that don't exist
I don't know why the commits you saved contain such invalid references, perhaps you were propagating changes to your entities, templates by just copying files, folders from somewhere else (perhaps from other machines?) into your
datafolder directly? that is the best theory we have so far for this mystery, if you were indeed doing this, then in the future don't propagate changes in this way, modifying the data directory directly is not recommended and will produce unexpected behaviour (like this one), prefer the import-export flow.
in order to fix the error you have, you would have to get rid of the invalid data, you need to delete the
data/versionsfile, this, unfortunately, will lose all your commits, but I think you were just testing the VC, so this is probably ok for you right now.
remember to not modify the data directory manually, and instead propagate changes with export files
@bjrmatos we did not edit anything directly in the data folder. We only use jsreport studio. We were about to go live with 30 reports in our software when this issue occurred so we are not happy to lose everything. I think to move forward we will be looking for another report provider.
we did not edit anything directly in the data folder. We only use jsreport studio
I see, this is just the theory we had because it happened a lot with other people when uploading files to amazon instances, usually, they replace all the files (including the node_modules) by using FTP, and when you combine that with situations that devs that work with different machines does not centralize the work things can get messy.
We were about to go live with 30 reports in our software when this issue occurred so we are not happy to lose everything
do you mean that when this issue happened again you ended up losing all your entities? or perhaps you are misunderstanding what I said here
in order to fix the error you have, you would have to get rid of the invalid data, you need to delete the data/versions file, this, unfortunately, will lose all your commits, but I think you were just testing the VC, so this is probably ok for you right now.
what I meant here is that you can safely delete the file
data/versions, then start your server again, your entities won't be deleted, only the commits history (what you see in the commit UI) will be deleted, there should be no harm doing that because your commit history is corrupted right now
Our original problem isn't with the version data, it is the missing files that we want to get back from the version history
ok, can you please describe which commit you want to revert? that will help me to fix the version control history in your data, and will allow you to use the revert again.
btw, the references starting to be corrupted starting from this "Test" commit
do you remember if you did something different in the studio or something else that could cause this? like for example deleting entities and re-creating them, I ask this because this particular commit contains changes to the identity of the entities (like you see for example if you click the commit and look for the changes in /sheets/shared)
such change to the identity (changing _id, shortid) should not be produced from any part of the studio, in that particular "Test" commit I am mentioning there a lot of changes like these, to other folders changing its identity. If you can remember something about it, it would help us to understand what happened.
Hi @bjrmatos we are looking to go back to 08062022. The only thing we did, was upgrade JSReport from 3.1.1 to 3.6.2 on 16/06/2022.
with the copy of the
datafolder you shared with us I prepared the changes to go back to the "08062022", @pofider is going to share this new data folder with you via email.
if you have done some other changes since you shared the copy of your data, please send again the last copy of your
data, so I can apply the changes there and share it back with you, if there are not any other changes just download the data from the email and replace your existing data folder with the one from the email, before replacing your existing
datafolder, make a copy of your existing
./datafolder and save it somewhere else, do this as a backup in case you need for some reason return to the same state you currently have.
in the process of restoring your data, we detected that the revert of some files is not working, we are preparing a hotfix release for this, but in the meantime, you should be fine if you don't use the revert in the uncommitted changes UI.