"Session Expired - Refresh now" loop in Dev environment

Hi!

I want to check my last changes running the app and I only can do the following (press the button refresh and getting no update):

refresh_now

I deleted all cookies but the problem persists.

I was trying to use requests_cache package in the “Full Python 3” environment. I deleted my changes and no changes.

Ahh, this first happens after trying the new Anvil Editor in Beta.

Any help will be appreciated, best!

Matias

Have you tried checking out an older version, one that you are sure it was working?

1 Like

My current version does not have changes wrt the last one that was working, but I came back to an older version with no success :frowning:

My published app works perfectly. The problem is in the development environment.

… I waited some days to see if the problem is solved by magic art, and no success :frowning:

Hi @lee.matias,
Have you managed to solve you problem?
I’m having the same issue.
I tried to switch to the latest working version, and the problem appeared there too!
It works correctly if I run the app from the development environment but in a new tab, which is a temporary workaround.

My app uses a cookie to store a row id between sessions, when I delete this cookie it works again, but I have to do it before each run.

Hi! I was no able to solve the problem. My work around is to use the the browser in private mode and login with my development account. :sunglasses:

Best,

Matías

1 Like

Thank you for your reply. We’ll have to do with workarounds for the moment then…

@charles.e.georges @lee.matias We’re looking into this right now, could you share some information regarding:

  1. What browser you’re using
  2. Whether the same thing is happening in the Beta Editor, and whether it is the same if you run your app in a new tab vs. in maximised/split view
  3. @charles.e.georges what cookie are you deleting exactly?

Hi Patricia,

  1. I’m having the problem in Firefox 108.0 on Windows 11. I’ve tried Chrome and it works correctly.

  2. I’m using the Beta Editor. The problem arises when I run the app in split view or maximized view. It doesn’t happen when I run in a new tab or in the published app.
    I’ve tried the classic editor, same problem.

  3. My app uses a cookie to save a row ID and retrieve data between sessions. When I delete that cookie, the following run works normally. And then the issue reappears in the next run.

I hope this helps!

Checkin right now to answer your questions:

1 - I am using firefox.
2 - The same happens in both editors. In the old version, I press RUN and a full-size window is opened. In the new version, I press RUN and the window is opened in the right sector of the browser.

BTW, in my firefox I have 4 different google accounts running at the same time. I think this is the problem and for that reason using private mode works well.

Thanks!

Matias

Hi all,

Next question (I appreciate this sounds strange but I promise you we’re working a theory, to do with how Firefox specifically has changed cookie handling in iframes):

  1. @charles.e.georges can I ask you to be very specific - when you say “I delete that cookie” what steps do you actually go through in Firefox?

  2. For all: Does this problem happen with every app you run, or only some apps? And do your apps do anything that opens a pop-up outside the editor (I’m thinking particularly Google/Microsoft/etc logins).

The good news is that for now this problem can apparently be worked around by using Chrome. We still haven’t managed to reproduce it on this end, but your answers here are helping!

Hi Meredy,

About 2, I only have one app. The problem happened when I wanted to log in with one of my google accounts (the app open a pop-up to choose the account). I tried again and the problem looks as solved in Firefox. Nice work! :clap: :clap: :clap:

Thanks!!

Matías

Hi Meredydd,

  1. Settings > Privacy and Security > Cookies and site data > Manage date
    then I search for anvil, I see 2 lines anvil.works and anvil.app. I select anvil.app then I click on Remove selected, Save changes, Remove.
    After that, I can run the app in split view and it will work. But it creates a new cookie and when I run it again, I get the Session expired popup.

  2. I tried my two other apps, the problem doesn’t happen.
    None of my apps have login popups, but two of them have popup forms made using alert(), but one of them works perfectly and even for the one that has the problem, the problem appears on a page where there is no such form.

I made further investigations by commenting out any code that has to do with storing and retrieving my cookie and the problem still occurs.
I then checked the cookies with Firefox inspection tool and it seems that as soon as I run the app, 3 cookies are created automatically.

So to be clear, these cookies are not created in my code. When I delete them, the following run works correctly.

I hope this helps.

I too confirm the same bug.
Browser: Firefox

Currently, i am using workaround by placing a function call before any call to server. In dev environment, that function has anvil.server.reset_session(), which just solves my problem

Whenever i want to make a release, i just comment the part of code that resets session

But this is a big hess-mess

Hi folks,

I can confirm I’ve got this issue reproduced on the latest Firefox, so we’ll run it down. It’s Christmas Eve, so I can’t guarantee an immediate resolution, but we’ll get on it when the Christmas pudding wears off!

For now, the workaround is to use the Beta Editor, and to choose Run in new tab:

image

(Or, of course, to use Chrome or a Chrome-based browser.)

@meredydd I’m experiencing this issue. Any resolution yet?

I’ve been having this issue too for ages - finally got round to searching the forums for it today and found this. I’m also using Firefox. If I can help debug in any way let me know.

I also have the same problem, but not for all browsers/apps.

Specifically: Firefox (on Macs, latest os).

Tried to turn off all kinds of blockers, clear cache, updates etc. Still a problem.

No problems in Chrome.

Weakly founded hypothesis: Apps that use the login form (and specifically when using google login) seem to run fine the first time, but then cause problem on the second run. Simple apps with no login worked fine (tested only one …).