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

Auth redirect to blank page & Cannot read properties of null (reading 'postMessage') #4107

Open
2 tasks done
S0c5 opened this issue Sep 13, 2022 · 8 comments
Open
2 tasks done
Assignees
Labels

Comments

@S0c5
Copy link

S0c5 commented Sep 13, 2022

Initial checklist

  • I understand this is a bug report and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

Link to runnable example

No response

Steps to reproduce

how to reproduce?

  • Instgram app installed
  • Android 11
  1. open browser https://uppy.io/examples/dashboard/
  2. connect with instagram
  3. when the user authorizes Instagram app in the browser (chrome) is get redirected to a blank page

What is causing the error:

  1. lost of context for window.opener when user is redirected through app to the authorization page.
window.opener.sendMessage({ token }) // at instagram/send-token

Work around?

  • we need to send the token via webSockets

Expected behavior

That I coud connect with instagram

Actual behavior

blank page at
instagram/send-token/

@S0c5 S0c5 changed the title When user authorize instagram and get redirect it gets a blank page When user authorize instagram, when user is redirected, he gets a blank page Sep 13, 2022
@S0c5 S0c5 changed the title When user authorize instagram, when user is redirected, he gets a blank page BUG When user authorize instagram, user is redirected and gets a blank page. Sep 13, 2022
@S0c5 S0c5 changed the title BUG When user authorize instagram, user is redirected and gets a blank page. BUG When user authorizes instagram in Android, user is redirected but gets a blank page. Sep 13, 2022
@mifi
Copy link
Contributor

mifi commented Sep 14, 2022

Is this a duplicate of #2295 or a different issue?

@arturi
Copy link
Contributor

arturi commented Sep 14, 2022

Looks like the same. I wonder if WebSockets could be the answer indeed?

@mifi
Copy link
Contributor

mifi commented Sep 14, 2022

  1. lost of context for window.opener

what does this actually mean in technical terms? what is a context?
I'm not sure why WebSockets is a "magical solution".

@Murderlon
Copy link
Member

It's also a bit hard to grasp for me what the up and downsides of using websockets for this particular case are.

@arturi arturi removed the Triage label Jul 6, 2023
@StrixOSG
Copy link

We noticed this issue as well, but also on a Mac (both Chrome and Safari). Not sure if it's related, but it seems close. Sign in, get redirected to a blank page, and this shows up in the console as an error:

Uncaught TypeError: Cannot read properties of null (reading 'postMessage') 
at send-token?uppyAuthToken=...

@StrixOSG
Copy link

StrixOSG commented Aug 16, 2023

Is there any updates on a fix or #4110 @mifi ? I've noticed this issue on Android for a while, but now that it potentially affects some users on Desktop, this is more of a concern to me. I should note some of our users get this, some don't. It's unclear why, and I also seem to be getting the same error on the Uppy home page when connecting my Instagram account.

@mifi
Copy link
Contributor

mifi commented Aug 17, 2023

If it can be reproduced somehow on desktop, that would make it easier to look into a fix

@StrixOSG
Copy link

StrixOSG commented Aug 30, 2023

I've done some testing locally, and couldn't come up with a fix, but I think I got much closer. It seems the likely culprit is window.opener.postMessage not having any context. In the browser, it complains that postMessage is null, which really it's because opener is null. For some reason the context is being lost (in some cases) and opener is null. I tried modifying things on the server side such as waiting for window.onload and then executing the window.opener.postMessage but to no avail. It might be client side where window.open() is called to redirect to Instagram that needs a bit more help. My best guess right now is that maybe for some Instagram accounts there is a few more redirects and it messes with opener context, but I'm not sure. Hopefully this sheds a bit more light at least and moves us closer to a fix. As suggested originally, webSockets may be the best solution here

@mifi mifi changed the title BUG When user authorizes instagram in Android, user is redirected but gets a blank page. Auth redirect to blank page & Cannot read properties of null (reading 'postMessage') Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants