medic / cht-core

The CHT Core Framework makes it faster to build responsive, offline-first digital health apps that equip health workers to provide better care in their communities. It is a central resource of the Community Health Toolkit.
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
467 stars 217 forks source link

Chrome/Chromium: Infinite redirect after login #1108

Closed ghost closed 9 years ago

ghost commented 9 years ago

On Chrome and Chromium (but not Firefox), I'm finally able to reproduce the infinite-redirect-after-login that Alex reported a few weeks ago.

Steps to reproduce: check out the develop branch of medic-webapp, push the app to an empty database using grunt dev, start medic-api, and visit http://localhost:5988/medic/_design/medic/_rewrite to log in. After a successful login, you'll see repeated reloads.

garethbowen commented 9 years ago

The session management has been reworked to solve #1112 which I think also solves this, however I've never managed to replicate this issue. So I'll close this but reopen it if you come across it again.

mandric commented 9 years ago

screen shot 2015-08-17 at 5 55 33 pm

Creating Application Cache with manifest https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/manifest.appcache
_rewrite:1 Application Cache Checking event
Navigated to https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite
_rewrite:1 Application Cache Downloading event
_rewrite:1 Application Cache Progress event (0 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/select2x2.png
_rewrite:1 Application Cache Progress event (1 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/inbox.js
_rewrite:1 Application Cache Progress event (2 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/medic-logo-light.svg
_rewrite:1 Application Cache Progress event (3 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/icon-chw.svg
_rewrite:1 Application Cache Progress event (4 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/medic-logo-50h.png
_rewrite:1 Application Cache Progress event (5 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/FontAwesome.otf
_rewrite:1 Application Cache Progress event (6 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_48.png
_rewrite:1 Application Cache Progress event (7 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/icon-nurse.svg
_rewrite:1 Application Cache Progress event (8 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_16.png
_rewrite:1 Application Cache Progress event (9 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.eot
_rewrite:1 Application Cache Progress event (10 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/medic-logo-light-full.svg
_rewrite:1 Application Cache Progress event (11 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_48.ico
_rewrite:1 Application Cache Progress event (12 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/workflows/basic-anc.png
inbox.js:14 Error syncing ddoc. Bootstrapping anyway. SyntaxError: Unexpected token <
    at Object.parse (native)
    at c (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:9:21842)
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:9:22852
    at XMLHttpRequest.25.c.onreadystatechange (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:9:26885)d.forEach.console.(anonymous function) @ inbox.js:14(anonymous function) @ inbox.js:2881.d.emit @ dependencies.js:11f @ dependencies.js:10t @ dependencies.js:11s @ dependencies.js:11(anonymous function) @ dependencies.js:11
_rewrite:1 Application Cache Progress event (13 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_16.ico
_rewrite:1 Application Cache Progress event (14 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.ttf
inbox.js:14 TypeError: Cannot read property 'name' of undefined
    at inbox.js:32
    at inbox.js:2
    at inbox.js:2
    at l (inbox.js:2)
    at k (inbox.js:2)
    at L.forEachOf.L.eachOf (inbox.js:2)
    at D (inbox.js:2)
    at Object.L.parallel (inbox.js:2)
    at a.factory.j (inbox.js:31)
    at inbox.js:31d.forEach.console.(anonymous function) @ inbox.js:14(anonymous function) @ dependencies.js:3$get @ dependencies.js:3$get.n.$apply @ dependencies.js:4(anonymous function) @ dependencies.js:2e @ dependencies.js:2h @ dependencies.js:2ga @ dependencies.js:2(anonymous function) @ inbox.js:28d @ dependencies.js:4c @ dependencies.js:2
inbox.js:14 Error initializing DB sync Error: {"status":404,"name":"not_found","message":"missing"}
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/inbox.js:32:4266
    at i (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:3:30399)
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:3:30571
    at n.$get.n.$eval (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:4:6168)
    at n.$get.n.$digest (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:4:4599)
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:4:6255
    at e (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:2:21064)
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:2:22493
_rewrite:1 Application Cache Progress event (15 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/dependencies.js
_rewrite:1 Application Cache Progress event (16 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/select2.js
dependencies.js:28 DELETE https://_:_@alpha.dev.medicmobile.org/_session 401 (Unauthorized)_.ajaxTransport.Y.cors.a.crossDomain.send @ dependencies.js:28_.extend.ajax @ dependencies.js:28c.request @ inbox.js:14c.logout @ inbox.js:27a.factory.h @ inbox.js:32a.factory.init @ inbox.js:32(anonymous function) @ inbox.js:29e @ dependencies.js:2$get.l.instance @ dependencies.js:3q @ dependencies.js:2h @ dependencies.js:2h @ dependencies.js:2h @ dependencies.js:2$get.b @ dependencies.js:2(anonymous function) @ dependencies.js:2$get.n.$eval @ dependencies.js:4$get.n.$apply @ dependencies.js:4(anonymous function) @ dependencies.js:2e @ dependencies.js:2h @ dependencies.js:2ga @ dependencies.js:2(anonymous function) @ inbox.js:28d @ dependencies.js:4c @ dependencies.js:2
_rewrite:1 Application Cache Progress event (17 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.woff
_rewrite:1 Application Cache Progress event (18 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.woff2
_rewrite:1 Application Cache Progress event (19 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/select2-spinner.gif
_rewrite:1 Creating Application Cache with manifest https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/manifest.appcache
_rewrite:1 Application Cache Checking event
Navigated to https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite
_rewrite:1 Application Cache Downloading event
_rewrite:1 Application Cache Progress event (0 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/select2x2.png
_rewrite:1 Application Cache Progress event (1 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/inbox.js
_rewrite:1 Application Cache Progress event (2 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/medic-logo-light.svg
_rewrite:1 Application Cache Progress event (3 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/icon-chw.svg
_rewrite:1 Application Cache Progress event (4 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/medic-logo-50h.png
_rewrite:1 Application Cache Progress event (5 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/FontAwesome.otf
_rewrite:1 Application Cache Progress event (6 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_48.png
_rewrite:1 Application Cache Progress event (7 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/icon-nurse.svg
_rewrite:1 Application Cache Progress event (8 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_16.png
_rewrite:1 Application Cache Progress event (9 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/medic-logo-light-full.svg
_rewrite:1 Application Cache Progress event (10 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.eot
_rewrite:1 Application Cache Progress event (11 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_48.ico
_rewrite:1 Application Cache Progress event (12 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/workflows/basic-anc.png
inbox.js:14 Error syncing ddoc. Bootstrapping anyway. SyntaxError: Unexpected token <
    at Object.parse (native)
    at c (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:9:21842)
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:9:22852
    at XMLHttpRequest.25.c.onreadystatechange (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:9:26885)d.forEach.console.(anonymous function) @ inbox.js:14(anonymous function) @ inbox.js:2881.d.emit @ dependencies.js:11f @ dependencies.js:10t @ dependencies.js:11s @ dependencies.js:11(anonymous function) @ dependencies.js:11
inbox.js:14 TypeError: Cannot read property 'name' of undefined
    at inbox.js:32
    at inbox.js:2
    at inbox.js:2
    at l (inbox.js:2)
    at k (inbox.js:2)
    at L.forEachOf.L.eachOf (inbox.js:2)
    at D (inbox.js:2)
    at Object.L.parallel (inbox.js:2)
    at a.factory.j (inbox.js:31)
    at inbox.js:31d.forEach.console.(anonymous function) @ inbox.js:14(anonymous function) @ dependencies.js:3$get @ dependencies.js:3$get.n.$apply @ dependencies.js:4(anonymous function) @ dependencies.js:2e @ dependencies.js:2h @ dependencies.js:2ga @ dependencies.js:2(anonymous function) @ inbox.js:28d @ dependencies.js:4
_rewrite:1 Application Cache Progress event (13 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_16.ico
_rewrite:1 Application Cache Progress event (14 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.ttf
inbox.js:14 Error initializing DB sync Error: {"status":404,"name":"not_found","message":"missing"}
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/inbox.js:32:4266
    at i (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:3:30399)
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:3:30571
    at n.$get.n.$eval (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:4:6168)
    at n.$get.n.$digest (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:4:4599)
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:4:6255
    at e (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:2:21064)
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:2:22493
dependencies.js:28 DELETE https://_:_@alpha.dev.medicmobile.org/_session 401 (Unauthorized)_.ajaxTransport.Y.cors.a.crossDomain.send @ dependencies.js:28_.extend.ajax @ dependencies.js:28c.request @ inbox.js:14c.logout @ inbox.js:27a.factory.h @ inbox.js:32a.factory.init @ inbox.js:32(anonymous function) @ inbox.js:29e @ dependencies.js:2$get.l.instance @ dependencies.js:3q @ dependencies.js:2h @ dependencies.js:2h @ dependencies.js:2h @ dependencies.js:2$get.b @ dependencies.js:2(anonymous function) @ dependencies.js:2$get.n.$eval @ dependencies.js:4$get.n.$apply @ dependencies.js:4(anonymous function) @ dependencies.js:2e @ dependencies.js:2h @ dependencies.js:2ga @ dependencies.js:2(anonymous function) @ inbox.js:28d @ dependencies.js:4
_rewrite:1 Application Cache Progress event (15 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/dependencies.js
_rewrite:1 Application Cache Progress event (16 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/select2.js
_rewrite:1 Application Cache Progress event (17 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.woff
_rewrite:1 Application Cache Progress event (18 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.woff2
_rewrite:1 Application Cache Progress event (19 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/select2-spinner.gif
_rewrite:1 Creating Application Cache with manifest https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/manifest.appcache
_rewrite:1 Application Cache Checking event
Navigated to https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite
_rewrite:1 Application Cache Downloading event
_rewrite:1 Application Cache Progress event (0 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/inbox.js
_rewrite:1 Application Cache Progress event (1 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/select2x2.png
_rewrite:1 Application Cache Progress event (2 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/medic-logo-light.svg
_rewrite:1 Application Cache Progress event (3 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/icon-chw.svg
_rewrite:1 Application Cache Progress event (4 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/medic-logo-50h.png
_rewrite:1 Application Cache Progress event (5 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/FontAwesome.otf
_rewrite:1 Application Cache Progress event (6 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_48.png
_rewrite:1 Application Cache Progress event (7 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/icon-nurse.svg
_rewrite:1 Application Cache Progress event (8 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_16.png
_rewrite:1 Application Cache Progress event (9 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/medic-logo-light-full.svg
_rewrite:1 Application Cache Progress event (10 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.eot
inbox.js:14 Error syncing ddoc. Bootstrapping anyway. SyntaxError: Unexpected token <
    at Object.parse (native)
    at c (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:9:21842)
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:9:22852
    at XMLHttpRequest.25.c.onreadystatechange (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:9:26885)d.forEach.console.(anonymous function) @ inbox.js:14(anonymous function) @ inbox.js:2881.d.emit @ dependencies.js:11f @ dependencies.js:10t @ dependencies.js:11s @ dependencies.js:11(anonymous function) @ dependencies.js:11
inbox.js:14 TypeError: Cannot read property 'name' of undefined
    at inbox.js:32
    at inbox.js:2
    at inbox.js:2
    at l (inbox.js:2)
    at k (inbox.js:2)
    at L.forEachOf.L.eachOf (inbox.js:2)
    at D (inbox.js:2)
    at Object.L.parallel (inbox.js:2)
    at a.factory.j (inbox.js:31)
    at inbox.js:31d.forEach.console.(anonymous function) @ inbox.js:14(anonymous function) @ dependencies.js:3$get @ dependencies.js:3$get.n.$apply @ dependencies.js:4(anonymous function) @ dependencies.js:2e @ dependencies.js:2h @ dependencies.js:2ga @ dependencies.js:2(anonymous function) @ inbox.js:28d @ dependencies.js:4
inbox.js:14 Error initializing DB sync Error: {"status":404,"name":"not_found","message":"missing"}
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/inbox.js:32:4266
    at i (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:3:30399)
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:3:30571
    at n.$get.n.$eval (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:4:6168)
    at n.$get.n.$digest (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:4:4599)
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:4:6255
    at e (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:2:21064)
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:2:22493
_rewrite:1 Application Cache Progress event (11 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_48.ico
_rewrite:1 Application Cache Progress event (12 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/workflows/basic-anc.png
dependencies.js:28 DELETE https://_:_@alpha.dev.medicmobile.org/_session 401 (Unauthorized)_.ajaxTransport.Y.cors.a.crossDomain.send @ dependencies.js:28_.extend.ajax @ dependencies.js:28c.request @ inbox.js:14c.logout @ inbox.js:27a.factory.h @ inbox.js:32a.factory.init @ inbox.js:32(anonymous function) @ inbox.js:29e @ dependencies.js:2$get.l.instance @ dependencies.js:3q @ dependencies.js:2h @ dependencies.js:2h @ dependencies.js:2h @ dependencies.js:2$get.b @ dependencies.js:2(anonymous function) @ dependencies.js:2$get.n.$eval @ dependencies.js:4$get.n.$apply @ dependencies.js:4(anonymous function) @ dependencies.js:2e @ dependencies.js:2h @ dependencies.js:2ga @ dependencies.js:2(anonymous function) @ inbox.js:28d @ dependencies.js:4
_rewrite:1 Application Cache Progress event (13 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_16.ico
_rewrite:1 Application Cache Progress event (14 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.ttf
_rewrite:1 Application Cache Progress event (15 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/dependencies.js
_rewrite:1 Application Cache Progress event (16 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/select2.js
_rewrite:1 Application Cache Progress event (17 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.woff
_rewrite:1 Application Cache Progress event (18 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.woff2
_rewrite:1 Creating Application Cache with manifest https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/manifest.appcache
_rewrite:1 Application Cache Checking event
Navigated to https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite
_rewrite:1 Application Cache Downloading event
_rewrite:1 Application Cache Progress event (0 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/select2x2.png
_rewrite:1 Application Cache Progress event (1 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/inbox.js
_rewrite:1 Application Cache Progress event (2 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/icon-chw.svg
_rewrite:1 Application Cache Progress event (3 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/medic-logo-light.svg
_rewrite:1 Application Cache Progress event (4 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/medic-logo-50h.png
_rewrite:1 Application Cache Progress event (5 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/FontAwesome.otf
_rewrite:1 Application Cache Progress event (6 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/icon-nurse.svg
_rewrite:1 Application Cache Progress event (7 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_48.png
_rewrite:1 Application Cache Progress event (8 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/medic-logo-light-full.svg
_rewrite:1 Application Cache Progress event (9 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_16.png
inbox.js:14 Error syncing ddoc. Bootstrapping anyway. SyntaxError: Unexpected token <
    at Object.parse (native)
    at c (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:9:21842)
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:9:22852
    at XMLHttpRequest.25.c.onreadystatechange (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:9:26885)d.forEach.console.(anonymous function) @ inbox.js:14(anonymous function) @ inbox.js:2881.d.emit @ dependencies.js:11f @ dependencies.js:10t @ dependencies.js:11s @ dependencies.js:11(anonymous function) @ dependencies.js:11
inbox.js:14 TypeError: Cannot read property 'name' of undefined
    at inbox.js:32
    at inbox.js:2
    at inbox.js:2
    at l (inbox.js:2)
    at k (inbox.js:2)
    at L.forEachOf.L.eachOf (inbox.js:2)
    at D (inbox.js:2)
    at Object.L.parallel (inbox.js:2)
    at a.factory.j (inbox.js:31)
    at inbox.js:31d.forEach.console.(anonymous function) @ inbox.js:14(anonymous function) @ dependencies.js:3$get @ dependencies.js:3$get.n.$apply @ dependencies.js:4(anonymous function) @ dependencies.js:2e @ dependencies.js:2h @ dependencies.js:2ga @ dependencies.js:2(anonymous function) @ inbox.js:28d @ dependencies.js:4
inbox.js:14 Error initializing DB sync Error: {"status":404,"name":"not_found","message":"missing"}
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/inbox.js:32:4266
    at i (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:3:30399)
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:3:30571
    at n.$get.n.$eval (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:4:6168)
    at n.$get.n.$digest (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:4:4599)
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:4:6255
    at e (https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:2:21064)
    at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/static/dist/dependencies.js:2:22493
_rewrite:1 Application Cache Progress event (10 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_48.ico
dependencies.js:28 DELETE https://_:_@alpha.dev.medicmobile.org/_session 401 (Unauthorized)_.ajaxTransport.Y.cors.a.crossDomain.send @ dependencies.js:28_.extend.ajax @ dependencies.js:28c.request @ inbox.js:14c.logout @ inbox.js:27a.factory.h @ inbox.js:32a.factory.init @ inbox.js:32(anonymous function) @ inbox.js:29e @ dependencies.js:2$get.l.instance @ dependencies.js:3q @ dependencies.js:2h @ dependencies.js:2h @ dependencies.js:2h @ dependencies.js:2$get.b @ dependencies.js:2(anonymous function) @ dependencies.js:2$get.n.$eval @ dependencies.js:4$get.n.$apply @ dependencies.js:4(anonymous function) @ dependencies.js:2e @ dependencies.js:2h @ dependencies.js:2ga @ dependencies.js:2(anonymous function) @ inbox.js:28d @ dependencies.js:4
_rewrite:1 Application Cache Progress event (11 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.eot
_rewrite:1 Application Cache Progress event (12 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/workflows/basic-anc.png
_rewrite:1 Application Cache Progress event (13 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_16.ico
_rewrite:1 Application Cache Progress event (14 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.ttf
_rewrite:1 Application Cache Progress event (15 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/dependencies.js
_rewrite:1 Creating Application Cache with manifest https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/manifest.appcache
_rewrite:1 Application Cache Checking event
Navigated to https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite
_rewrite:1 Application Cache Downloading event
_rewrite:1 Application Cache Progress event (0 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/select2x2.png
_rewrite:1 Application Cache Progress event (1 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/inbox.js
_rewrite:1 Application Cache Progress event (2 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/medic-logo-light.svg
_rewrite:1 Application Cache Progress event (3 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/icon-chw.svg
_rewrite:1 Application Cache Progress event (4 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/medic-logo-50h.png
_rewrite:1 Application Cache Progress event (5 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/FontAwesome.otf
_rewrite:1 Application Cache Progress event (6 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_48.png
_rewrite:1 Application Cache Progress event (7 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/icon-nurse.svg
_rewrite:1 Application Cache Progress event (8 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_16.png
_rewrite:1 Application Cache Progress event (9 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/medic-logo-light-full.svg
_rewrite:1 Application Cache Progress event (10 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.eot
_rewrite:1 Application Cache Progress event (11 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_48.ico
_rewrite:1 Application Cache Progress event (12 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/workflows/basic-anc.png
_rewrite:1 Application Cache Progress event (13 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/ico/icon_16.ico
_rewrite:1 Application Cache Progress event (14 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.ttf
_rewrite:1 Application Cache Progress event (15 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/dependencies.js
_rewrite:1 Application Cache Progress event (16 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/select2.js
_rewrite:1 Application Cache Progress event (17 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.woff
_rewrite:1 Application Cache Progress event (18 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.woff2
_rewrite:1 Application Cache Progress event (19 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/select2-spinner.gif
_rewrite:1 Application Cache Progress event (20 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/icon-nurse-selected.svg
_rewrite:1 Application Cache Progress event (21 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/inbox.css
_rewrite:1 Application Cache Progress event (22 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/select2.png
_rewrite:1 Application Cache Progress event (23 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/admin.css
_rewrite:1 Application Cache Progress event (24 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/icon-pregnant.svg
_rewrite:1 Application Cache Progress event (25 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/icon-pregnant-selected.svg
_rewrite:1 Application Cache Progress event (26 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/templates.js
_rewrite:1 Application Cache Progress event (27 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/setup-wizard-demo.png
_rewrite:1 Application Cache Progress event (28 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/dist/enketo.js
_rewrite:1 Application Cache Progress event (29 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/img/icon-chw-selected.svg
_rewrite:1 Application Cache Progress event (30 of 31) https://alpha.dev.medicmobile.org/medic/_design/medic/static/fonts/fontawesome-webfont.svg
_rewrite:1 Application Cache Progress event (31 of 31) 
_rewrite:1 Application Cache Cached event
garethbowen commented 9 years ago

I think the problem in the above trace is that the appcache download doesn't complete. This means that the old session management code is running and for whatever reason doesn't think the user is logged in so redirects back to the new api code which does think the user is logged in.

If this analysis is correct then it should only affect updates where the session management code is changed in a non-backwards compatible way.

Ideally when this happens we would invalidate the existing cache so the subsequent request would download everything from the server before starting rendering, so it would get the new session management code. Unfortunately the appcache spec doesn't expose this functionality.

I'm still working on a solution...

garethbowen commented 9 years ago

We can't invalidate the cache, but we can wait for the browser to finish downloading before redirecting the user. This will at least mean that the api and webapp code is up to date so the next login should work correctly.

abbyad commented 9 years ago

Not sure if this is the same issue, but posting here anyhow. After updating the alpha instance from 0.5 to 0.6 the webapp loaded properly with the "new version available" message. When reloading the page, it ends up in a reload loop, never displaying any content.

Console output: image

Network: image

ghost commented 9 years ago

Have you been able to reproduce with a direct push of develop, i.e. without an update? I'm almost certain this is update-related, and either API or nginx is returning an error page that (obviously) isn't valid JSON or JS after a partially-failed update.

garethbowen commented 9 years ago

Ok... next theory...

You already had a session established but no userCtx cookie (because those didn't exist in 0.5). When you reload:

  1. API checks for a couch session and lets you in
  2. webapp checks for a cookie and kicks you out
  3. etc

If this is right, then the fix is to have API check that the cookie is there too. If you have a session but no cookie then API should just create the cookie.