Closed Bug 1084087 Opened 10 years ago Closed 10 years ago

Signing to Marketplace using Fxa on 1.1 fails with b.redirect is undefined

Categories

(Cloud Services :: Server: Firefox Accounts, defect, P1)

x86
Gonk (Firefox OS)
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: krupa.mozbugs, Assigned: stomlinson)

References

()

Details

Attachments

(2 files)

Severity: normal → blocker
Edwin - 

1.1 is 70% of our user base so we're eager to address this issue.
When you get a sec, can you let us know if someone assigned and tracking?

Caitlin
Flags: needinfo?(edwong)
Oops sorry Edwin. Looks like Ckarlof is tracking - is there anyone else we need from the OS side at this point, or are we engaging all the right folks...
Component: Consumer Pages → Server: Firefox Accounts
Product: Marketplace → Mozilla Services
Version: 1.4 → other
Looks like there's a PR to validate params, it may fix this. Chris is tracking this.
Flags: needinfo?(edwong)
Assignee: nobody → rpappalardo
Our current fix is to just do better error messaging. If the "redirect" is actually undefined, the flow will fail.

:rpapa is working on helping us reproduce this bug on 1.1, since that's the only known place that it surfaces.
Priority: -- → P1
So in this case the we just have and incorrect config and we need to use the correct config somewhere? If so I'll drop the priority wayyyyyy down :)
Until we can reproduce it, we won't know for sure. :rpapa is going to take a look at it today with a 1.1 Hamachi.
Tony, do you know where I can find out what eng 1.1 version Marketplace (using FxA) shipped with? I'm trying to reproduce this bug for :krupa,  but first I need to figure out which specific version I should be flashing.  
https://github.com/mozilla/fxa-content-server/issues/1786
Also, for 1.1 versions, I assume I'd need to flash this on a Hamachi (not a Flame).  Do you know if 1.1 requires a specific base build?
Flags: needinfo?(tchung)
Per :tchung, no specific base build required. A 1.1 build can be had by looking in pvtbuilds here:
https://pvtbuilds.mozilla.org/pvt/mozilla.org/b2gotoro/nightly/
It's not obvious, but the 1.1 build is mozilla-b2g18-hamachi (user build only)
Once you know the date of this build, you can use the Taiwan tool (https://github.com/Mozilla-TWQA/B2G-flash-tool/) to flash it (to your Hamachi):
$ python ./flash_pvt.py -d hamachi -b 20140527041202 -g -G --usr

This will flash:
OS version: Boot2Gecko 1.1.1.0-prerelease
Platform version: 18.1

When I go to:
https://marketplace.firefox.com/app/mkt-dev on my flame, I am able to install the Marketplace dev app.
However, when I try to do the same on my newly-flashed Hamachi, all I see is a very small, underlined (inert) red letter "x" that looks like a URL.  Also, from within Settings app on the Hamachi, I don't see a way to login to FxA.  Are there some STR I need to get to where you observed this bug?
Flags: needinfo?(tchung) → needinfo?(krupa.mozbugs)
krupa / victor - 
any guidance for :rpapa on this?
Flags: needinfo?(vcarciu)
Flags: needinfo?(clouserw)
(In reply to Richard Pappalardo [:rpapa][:rpappalardo] from comment #8) 
> When I go to:
> https://marketplace.firefox.com/app/mkt-dev on my flame, I am able to
> install the Marketplace dev app.
> However, when I try to do the same on my newly-flashed Hamachi, all I see is
> a very small, underlined (inert) red letter "x" that looks like a URL. 

That happens when the phone can't load our CSS.  Check that you are online and that the time+date is correct on the phone.
Flags: needinfo?(clouserw)
(In reply to Wil Clouser [:clouserw] from comment #10)
> (In reply to Richard Pappalardo [:rpapa][:rpappalardo] from comment #8) 
> > When I go to:
> > https://marketplace.firefox.com/app/mkt-dev on my flame, I am able to
> > install the Marketplace dev app.
> > However, when I try to do the same on my newly-flashed Hamachi, all I see is
> > a very small, underlined (inert) red letter "x" that looks like a URL. 
> 
> That happens when the phone can't load our CSS.  Check that you are online
> and that the time+date is correct on the phone.
Thanks, Wil.  Setting date/time manually does allows me to now see the marketplace dev app correctly.
However, I still don't see FxA in the Settings app.  Do I need to load some prefs for FxA to be in place?
(In reply to Richard Pappalardo [:rpapa][:rpappalardo] from comment #11)
> (In reply to Wil Clouser [:clouserw] from comment #10)
> > (In reply to Richard Pappalardo [:rpapa][:rpappalardo] from comment #8) 
> > > When I go to:
> > > https://marketplace.firefox.com/app/mkt-dev on my flame, I am able to
> > > install the Marketplace dev app.
> > > However, when I try to do the same on my newly-flashed Hamachi, all I see is
> > > a very small, underlined (inert) red letter "x" that looks like a URL. 
> > 
> > That happens when the phone can't load our CSS.  Check that you are online
> > and that the time+date is correct on the phone.
> Thanks, Wil.  Setting date/time manually does allows me to now see the
> marketplace dev app correctly.
> However, I still don't see FxA in the Settings app.  Do I need to load some
> prefs for FxA to be in place?

I've been out of the office for the past week, so I'm not sure I'm the authority here.  However, I wouldn't expect to see FxA in the settings app of a 1.1 build.  The Marketplace as it exists today won't use the native FxA experience - it will use the web flow.  So, just loading the dev Marketplace should be enough to use FxA in the dev environment.
Thanks, Wil.  Now that I'm able to get in, I am able to repro this issue.

I'm able to 'sign up' initially, though "b.direct is undefined" also appears on the confirmation page.
I receive the verification email successfully, then verify.
Then, when I try to 'sign in,' once again i see "b.direct is undefined," but never go beyond the sign in page.
Let me know if there's anything else you'd like me to test with this.
Flags: needinfo?(vcarciu)
Flags: needinfo?(krupa.mozbugs)
adb logcat output 

PRE-CONDITIONS
* freshly flashed Hamachi 
* proper date/time set

Developer options enabled:
* Remote debugging
* Wi-Fi output in adb
* Console enabled
* Gaia debug traces

STR
* open browser
* go to: https://marketplace.firefox.com/app/mkt-dev/
* install Marketplace app
* open Marketplace app
* choose gear icon to arrive at FxA auth page
* login to FxA with existing user
* observe b.redirect undefined error
I was able to repro on Desktop Firefox 18, and found the problem. Thanks :rpapa! We can take it from here.
Assignee: rpappalardo → stomlinson
user_exists_b_redirect_undefined_on_login_HTTP.log

per jrgrm, adding to /system/bin/b2g.sh
export NSPR_LOG_MODULES=timestamp,cookie:5,nsSocketTransport:5,nsHttp:5
to add logging of network traffic

see line # 58204

adb logcat output 

PRE-CONDITIONS
* freshly flashed Hamachi 
* proper date/time set

Developer options enabled:
* Remote debugging
* Wi-Fi output in adb
* Console enabled
* Gaia debug traces

STR
* open browser
* go to: https://marketplace.firefox.com/app/mkt-dev/
* install Marketplace app
* open Marketplace app
* choose gear icon to arrive at FxA auth page
* login to FxA with existing user
* observe b.redirect undefined error
Sorry for the lack of information, I hit the submit button too soon.

This is caused by https://bugzilla.mozilla.org/show_bug.cgi?id=608735

After tracing through the code, I found out that we are suffering from this problem: 

* https://bugzilla.mozilla.org/show_bug.cgi?id=608735 (XMLHttpRequest's getAllResponseHeaders() returns null if the request is the result of CORS)
* http://bugs.jquery.com/ticket/10338

Because xhr.getAllResponseHeaders(), jQuery thinks the response is a text type and does not attempt to decode the response. A [jQuery patch](https://github.com/jquery/jquery/pull/517) was submitted but rejected because they punted back to us (Mozilla).

Jonas Sicking says the problem was fixed in Firefox 21:

> This should have been fixed in Firefox 21. Please provide a small testcase if you can still reproduce.

Possible work arounds (non-tested):
* Specify a 'json' dataType as you did in the above example for every jQuery request.
* Attempt to set the `dataType` universally in jQuery.ajaxSetup
* Detect whether a string or object was returned from jQuery.ajax, if a string, decode to JSON.
Fixed by https://github.com/mozilla/fxa-content-server/pull/1808

It will be in the FxA train cut today and hopefully released on 11/3.

It's available in our "latest" integration environment to test right now.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Verified as fixed. No b.undefined errors were observed during login.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: