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 9136409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:56:55+00:00 2026-06-17T08:56:55+00:00

I have this route that queries an API to get information about the project.

  • 0

I have this route that queries an API to get information about the project. It uses super agent to post a get request, passes along some headers with the .set and project_results should contain the data.

Now here is the issue: I can load the page for this particular route/project 20 times… 19 of the times it will work perfectly but randomly it will throw an error:

TypeError: Cannot read property 'creator' of null

This error points out the line: with if(project.creator == req.signedCookies.user_3rb._id) {

So I know it is making it past the: if(project_results.status == '200') {

and since I am looking at the same project over and over and over (and I know all projects have a creator I checked the DB)

my question would be why sometimes does it not find this property of the project_results variable? Its very inconsistent.. I would think project_results is completely populated before going through the code… since its passing the status check we know there is at least some data in the project_results variable..

app.get('/user/projects/:project_id', function(req, res, next) {
    var agent = superagent.agent();
  var project = {};

    project.id = req.params.project_id;

    agent
        .get(apihost + '/api/project/'+project.id)
        .set('api_key', apikey)
        .set('access_token', user.access_token)
        .end(function(project_error, project_results) {

            if (project_error) {
        console.log(project_error);
            }

            if(project_results.status == '200') { 

                project = JSON.parse(project_results.text);

                // Check if we are the owner of the project
                if(project.creator == req.signedCookies.user_3rb._id) { 
                    project.owner = true;
                }


                ......
  • 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-17T08:56:56+00:00Added an answer on June 17, 2026 at 8:56 am

    I’m one of the contributors to superagent.

    I’d recommend isolating a test case instead of trying to debug directly in your app.

    One simple way is to create a very short express app that always returns a hardcoded, perfect response to the route you’re trying to reach – then see if project is still null 1 in 20 times:

    var app = express();
    
    app.use(function(req, res, next) {
      res.send({
        // your data hardcoded here
      });
    });
    
    app.listen(3000);
    

    If it’s still null 1 in 20 times, then please submit it as an issue and I’ll check it out. If not, then likely something else is going on – perhaps the data isn’t being consistently fetched from the db, or there’s a race condition between the fetch and the rendering.

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

Sidebar

Related Questions

I have a route that is suppose to match something like this localhost:3000/site/admin and
I have a route defined like this: GET /question/:q_id controllers.Questions.viewQuestion(q_id: Long) Then in my
I have a route which routes a request to somepath/:id(.:format) to somecontroller#show . This
In my routes I have: resources :accounts This produces: accounts GET /accounts(.:format) accounts#index POST
I have an asp.net mvc app with a route that allows users to request
I have this route that let me build custom url for users like /thisismyname,
I have a route that works for my thing's show view. This object is
I have this route profile GET /contacts/:id(.:format) {:controller=>my_devise/contacts, :action=>profile} This is my controllers/application_controller.rb class
I have this route that worked before we upgraded our application to MVC3: routes.MapRoute(
I have the following URl: http://localhost:12981/BaseEvent/EventOverview/12?type=Film This is route: routes.MapRoute( Default, // Route name

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.