Skip to content

bigquery silly bug, table.exists for undefined returns true #1776

Description

@VikramTiwari

Environment details

  • OS:macOS
  • Node.js version:v6.9.1
  • npm version:3.10.9
  • google-cloud-node version:^0.43.0

Steps to reproduce

  1. require google-cloud
  2. Run the function
table.exists(undefined, function(err, exists){
// returns exists as true
})

Activity

  1. added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    api: bigqueryIssues related to the BigQuery API.
    on Nov 8, 2016
  2. stephenplusplus commented on Nov 8, 2016

    @stephenplusplus
    Contributor

    Thanks for reporting!

  3. stephenplusplus commented on Nov 8, 2016

    @stephenplusplus
    Contributor

    I haven't been able to reproduce. The exists method looks like this:

    ServiceObject.prototype.exists = function(callback) {
      this.get(function(err) {
        if (err) {
          if (err.code === 404) {
            callback(null, false);
          } else {
            callback(err);
          }
    
          return;
        }
    
        callback(null, true);
      });
    };

    Since callback is undefined if used the way your example shows, I get an error in the terminal:

    /Users/stephen/dev/play/gissue-1776/node_modules/@google-cloud/common/src/service-object.js:170
            callback(null, false);
            ^
    
    TypeError: callback is not a function
        at /Users/stephen/dev/play/gissue-1776/node_modules/@google-cloud/common/src/service-object.js:170:9
    

    Am I missing something?

  4. stephenplusplus commented on Nov 14, 2016

    @stephenplusplus
    Contributor

    @VikramTiwari since I'm still not sure about how to reproduce this one, I'm going to close. Please let me know if I have made an error in my attempt above.

  5. added a commit that references this issue on Mar 11, 2026
  6. added a commit that references this issue on Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

api: bigqueryIssues related to the BigQuery API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions