The wrong commit publish problem

I have a problem with the anvil, and I will explain the situation:

  1. I had a commit A and published it.
  2. I made a new commit B.
  3. I published B.
  4. I decided to publish A again and did it.
    But it shows still commit B.

Could anyone help me with this problem?

Does the A branch show the blue link icon next to it?

You can change which branch is published via the Publish button in the top right corner of the IDE. I think from memory you have to click the advanced button when you are in the publish screen.

1 Like

Thank you @rickhurlbatt. To add some details to the post by @hanieh.mirbabaei.
We are using the Anvil Beta Editor and set up two environments: One Production and one DEV environment. What we try to do now is to select a different commit to be used by one of the environments. So we select the commit via the publish settings. See here (email is blurred):

Then we click the blue button. After that, we click the “Close” button on the “Publish the App” settings, which raises an error without any content:

Looking at the version history, the commit - publish relation looks all right:

However, if we test the behavior of the app in the different environments, both environments still seem to point to the latest commit or master (In this case Development should be pointing at the older commit as displayed in the version history).

Seems to be a bug in the environment handling in the beta editor.

I haven’t tried setting a publish to a commit, only a separate branch. If you try to create a branch at the commit you wish to publish, does that work?

My implication being, Anvil has not set up published environments to work with commits, but the head of branches only, at this point in time.

Of course, this is all an assumption on my end.

Thanks, @anthonys, just tried what you suggested: Created a branch on this commit and pointed to the branch, not the commit: image

Same behavior though (Error message with no content and app behavior like the PROD environment).

1 Like

This definitely sounds like a bug.

To get you back on track in the meantime (while the Anvil Team is in UK in the middle of the night) you could try a couple of the options below:

  • Create a branch at an earlier commit and try publishing that - then merge changes in to the new published branch
  • Create a new environment all together and try publishing that.
  • Cloning the app and see if it makes any difference (you will lose the history of the app and the branches though so you will have to copy across any changes you have made that are not in the clone)

For any of the above I would try to use a commit from a known working point as a start.

Presumably you have tried shutting down your browser completely and restarting (probably not going to help but worth the 2 mins it takes)

Thanks, @rickhurlbatt. Not sure how I made it, but I was able to fix it. I created new commits in the different branches so they are following different paths in the git tree. Now it seems to work as expected.
I guess it’s still worth checking the behavior and especially the empty error alert to fix that bug. But at least I can continue my work from here.
Thanks, guys for your help!

Quick update: The issue appeared again, but I was able to narrow it down. The app itself seems to consider the correct environments now. However, I am using this app as a dependency and chose the Development environment to point to. However, in this case, the pointer does not work properly. It is still pointing to the Production environment.

Edit: I guess dependencies are not working with environments at all, right? Only master and Publish, but which publish are they taking?

Edit2: I tried to reproduce it with two other fresh apps. However, the dependencies are always pointing to the master, no matter if “Development” or “Published” is selected

Hmm sounds buggy. It might be best to reach out to support@anvil.works and get them to look in to it.

I can’t find the forum thread again, but I seem to recall that when you set a dependency to development, that will automatically point to the master branch. When you set it to published, that will automatically point to the published branch. Not the branch you have published, but a branch named published.

One of the Anvil folks can chime in if my memory’s faulty or if things have changed in the meantime.

2 Likes

You are right @jshaffstall. I just tried it with a new branch named published and now it works as expected if I switch between Development and Published. Is this really the desired behavior? Then the documentation should be updated on this.

With the classic editor, the branches were hidden from you and the IDE managed them. With the Beta editor, I agree, it should be made clear in the page on dependencies that it’s using specific branch names: Anvil Docs | Depending On Other Apps