Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7852093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:20:17+00:00 2026-06-02T19:20:17+00:00

I am using sessions in my Facebook Canvas Application using Sinatra and Rack. The

  • 0

I am using sessions in my Facebook Canvas Application using Sinatra and Rack.

The error that occurs in Facebook Canvas is:

NoMethodError - undefined method `session' for #<Hash:0xa3ed0a0>:
    /home/apoorv/.rvm/gems/ruby-1.9.2-p320/gems/sinatra-1.3.2/lib/sinatra/base.rb:170:in `session'

The problem is surely with Rack because when I run my application as follows:

ruby application.rb -p 3000

it does not display any error. I have tried installing rack version: 1.3.6 and 1.4.1, but the error persists.

I have also tried using the following code instead of enable :sessions

use Rack::Session::Cookie, :key => 'rack.session',
                           :domain => 'static.ak.facebook.com',
                           :path => '/',
                           :secret => 'change_me'

Do I need to upgrade/degrade to lower version of Rack or add some piece of Code to make this thing work?

edited

Also before coming across this issue I had an issue integrating my application in Facebook Canvas which was resolved by adding this line in config.ru:

set :protection, :except => [:remote_token, :frame_options] 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:20:20+00:00Added an answer on June 2, 2026 at 7:20 pm

    Using env['rack.session'] instead of session[] in the POST request recieved from Facebook solved this issue. Hope this helps to solve such problems

    Though it has not fully resolved complications because, now adding a redirect to code in the same POST callback displays: undefined method secure? error.

    I have not been able to solve this issue, though what I did was to avoid the redirect thing and instead add a functionality to the controller to handle different requests.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an issue with my Facebook canvas iframe application. I'm using sessions to
In my ASP.NET application using InProc sessions, Session_End calls a static method in another
I have an application that integrates with Facebook using Oauth 2. I can authorize
I have built an app using the facebook canvas method. This works in Mozilla
I have a facebook canvas application and I am using the latest version of
So, For the sake of performance, I'm using database sessions. I figure that while
I'm using CodeIgniter with CodeIgniter sessions that are stored in a MySQL database. I
Currently I'm using a session-per-request approach to manage Hibernate sessions in a Java web
I am struggling to keep the Facebook session alive using PHP on my website.
I am using the following code in my facebook application. The when loading the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.