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

Fix exception with non-expiring session tokens. #1386

Merged
merged 1 commit into from
Apr 5, 2016
Merged

Fix exception with non-expiring session tokens. #1386

merged 1 commit into from
Apr 5, 2016

Conversation

0x18B2EE
Copy link
Contributor

@0x18B2EE 0x18B2EE commented Apr 5, 2016

Session objects generated by parse.com (not sure about parse-server yet) will leave expiresAt undefined if they aren't set to expire in a year. Using these session tokens with parse-server causes Node to throw this exception:

error: error getting auth for sessionToken TypeError: Cannot read property 'iso' of undefined
    at /parse-example/node_modules/parse-server/lib/Auth.js:88:50
    at run (/parse-example/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:89:22)
    at /parse-example/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:102:28
    at flush (/parse-example/node_modules/babel-polyfill/node_modules/core-js/modules/_microtask.js:14:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)

This PR fixes that.

Session tokens generated by Parse with with "Expire inactive session" set
to No leave the the expiresAt field undefined. This fixes the TypeError
"Cannot read property 'iso' of undefined'" exception thrown when trying
to use a session token with undefined expiresAt.
@codecov-io
Copy link

Current coverage is 92.84%

Merging #1386 into master will decrease coverage by -0.01% as of 61399b0

@@            master   #1386   diff @@
======================================
  Files           86      86       
  Stmts         5446    5447     +1
  Branches      1003    1004     +1
  Methods          0       0       
======================================
  Hit           5057    5057       
- Partial          9      10     +1
  Missed         380     380       

Review entire Coverage Diff as of 61399b0

Powered by Codecov. Updated on successful CI builds.

@drew-gross
Copy link
Contributor

Sweet! Thanks for the PR!

@drew-gross drew-gross merged commit 1bd8046 into parse-community:master Apr 5, 2016
@nitrag
Copy link

nitrag commented Apr 15, 2016

I'm getting this error for a different reason maybe?

Environment Setup

AWS elastic beanstalk app
compose.io mongodb
php sdk (latest)

Steps to reproduce

  1. Login to website.
  2. Browse around
  3. Reboot ElasticBeanstalk deployment. ((does this cause the cache to lose logged in users??))
  4. Browse website, receive error

Logs/Trace

error: error getting auth for sessionToken TypeError: Cannot read property 'iso' of undefined
    at /var/app/current/node_modules/parse-server/lib/Auth.js:88:50
    at run (/var/app/current/node_modules/parse-server/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:89:22)
    at /var/app/current/node_modules/parse-server/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:102:28
    at flush (/var/app/current/node_modules/parse-server/node_modules/babel-polyfill/node_modules/core-js/modules/_microtask.js:14:5)
    at nextTickCallbackWith0Args (node.js:419:9)
    at process._tickDomainCallback (node.js:389:13)

@airdrummingfool
Copy link
Contributor

@nitrag this commit should fix your issue. It hasn't landed in a release of parse-server yet, so your deployment likely doesn't have the fix. It should be in 2.2.7 which will hopefully be released soon (I need it too!).

@nitrag
Copy link

nitrag commented Apr 15, 2016

Good to hear, thanks for your helpful contribution!

On Fri, Apr 15, 2016 at 10:29 AM, Tommy Goode notifications@github.com
wrote:

@nitrag https://github.com/nitrag this commit should fix your issue. It
hasn't landed in a release of parse-server yet, so your deployment likely
doesn't have the fix. It should be in 2.2.7 which will hopefully be
released soon (I need it too!).


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#1386 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants