-1

It looks like my req.session (.user) doesn't exist when my node app is on Heroku. Things work on my local machine, and when I push to heroku, I have access to my redis-to-go store for other uses, but when I log in and proceed to authenticated pages, I get "Internal Server Error" on the served page, and "Cannot read property 'currentUser' of undefined" in the log, w/undefined = req.session, I believe.

Also, I have the same redistogo code at the start of both files:

if process.env.REDISTOGO_URL
    rtg = require("url").parse(process.env.REDISTOGO_URL)
    redis = require("redis").createClient(rtg.port, rtg.hostname)
    redis.auth(rtg.auth.split(":")[1])
else
    redis = require("redis").createClient()

edit: I'm still rather new to Heroku/express/redis, and I realized that the problem may be that the code above isn't in the function that's being exported and called, so I moved it in, but I can't get it to deploy. After

git add .
git push heroku master
heroku releases

I get the same old list of deploys and rollbacks that I had before…

so, 1) My problem is that I had my code outside of the exported fn??

2) How do I push my changes? Have I possibly run out of memory on Heroku? my program isn't very large…

Edit2 - I figured it out. There were several small changes I needed to make.

Thanks, John

John T
  • 21
  • 4

1 Answers1

0

Try changing your first line to:

if (typeof(process.env.REDISTOGO_URL) !== 'undefined')

If that doesn't work, add console.log statements to see which side of the if..else statement you're hitting on Heroku.

Dan Kohn
  • 33,811
  • 9
  • 84
  • 100