Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] An unexpected error occurred (Could not establish connection. Receiving end does not exist) #2305

Closed
1 task done
rolznz opened this issue Apr 5, 2023 · 7 comments · Fixed by #2350
Closed
1 task done
Assignees

Comments

@rolznz
Copy link
Contributor

rolznz commented Apr 5, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Clicking on the extension icon while logged in sometimes throws and error and shows a logged-out state

Screenshots [optional]

image

image

image

image

Steps To Reproduce

First Issue:

  1. Checkout and build the latest master branch (yarn run dev:chrome)
  2. Login to the extension
  3. Close the popup
  4. Switch to a different application
  5. Go back to your browser and click the Alby extension icon

Second issue:

  1. Log into the extension with multiple accounts
  2. Switch from LND to an Alby hosted account (2nd screenshot)

Expected behavior

The popup opens and you are still logged in, with no errors. You can also switch accounts without errors.

Alby information

  • Master branch (latest)

Device information

Chrome Windows

Additional context

May be related to the recent manifest version 3 update

Are you working on this?

None

@reneaaron
Copy link
Contributor

You can stop any service worker manually by visiting the service worker page to reproduce this problem.

➡️ chrome://serviceworker-internals/?devtools

@rolznz
Copy link
Contributor Author

rolznz commented Apr 7, 2023

This URL is a bit better for managing the service worker: chrome://inspect/#service-workers

@kamalbuilds
Copy link
Contributor

Hi , can I work on this issue ? I am able to reproduce it . I think there is an issue with state and can try to resolve it .

Thanks.

image

@rolznz rolznz self-assigned this Apr 11, 2023
@rolznz rolznz added this to 🐝 Alby Apr 11, 2023
@rolznz rolznz moved this to 🏗️ In progress in 🐝 Alby Apr 11, 2023
@kamalbuilds
Copy link
Contributor

Ok @rolznz cool , If you wanna take on it 👍🏻

@rolznz
Copy link
Contributor Author

rolznz commented Apr 11, 2023

@legendarykamal if you are able to find the fix for this, great! I assigned it to me as we need to find a fix before the next release, and we are actively working on it.

@rolznz
Copy link
Contributor Author

rolznz commented Apr 11, 2023

Notes:

This issue started appearing in this merge commit: dd85f9a

My investigation so far:

When the service worker is terminated and re-launched, it takes some time to start up. The startup runs the full background script init() all over again.
The account context and settings context are sending messages before browser.runtime.onMessage.addListener(routeCalls); is called in background-script.init.
I managed to "fix" it by putting that line right at the top of the init function, but of course that will have other issues because it starts accepting messages when e.g. the db is not ready.
I am still not sure why the commit above caused the issue to start happening. But maybe if this is standard behaviour, then we should be waiting for the background script to initialize before requesting, or we can identify that the background script hasn't started and then re-do the failed request?

CC @escapedcat

@rolznz
Copy link
Contributor Author

rolznz commented Apr 11, 2023

We either need to fix this issue or revert the MV3 changes, because after we deploy them there is no way to go back.

@github-project-automation github-project-automation bot moved this from 🏗️ In progress to ✅ Done in 🐝 Alby Apr 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants