GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — TypeError: Cannot call method 'map' of undefined · Issue #424 · googleapis/google-cloud-node

TypeError: Cannot call method 'map' of undefined #424

New issue
Copy link
New issue
Copy link
Closed
Closed
TypeError: Cannot call method 'map' of undefined#424
Copy link
Assignees
stephenplusplus
Labels
🚨This issue needs some love.api: datastoreIssues related to the Datastore API.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
Milestone
Datastore Future

Description

@wingedrhino
wingedrhino
opened on Mar 4, 2015
Issue body actions

I setup an instance of type f1-micro in us-central1-f data center (machine type Ivy Bridge) running CentOS 7 to test some of my queries on as I plan to use google datastore as the backend db for a project.

The other details are that I enabled datastore service both for the project and for the instance while creating it.

Ran the following commands to update the system and get node running:

sudo yum install epel-release
sudo yum install vim git nodejs npm screen
sudo yum update
npm install gcloud
vim app.js

Dumped the following code into app.js:

'use strict';                                                                   
console.log('Entered app');                                                     
var gcloud = require('gcloud');                                                 
console.log('Imported gcloud');                                                 
var db = gcloud.datastore.dataset({                                        
  projectId: "<my actual project ID>"                                                
});                                                                             
var phone = '000000';                                                    
var userExistenceCheckQuery = {                                                 
  kinds: [{name: 'User'}],                                                      
  filter: {                                                                     
    propertyFilter: {                                                           
      property: {name: 'phone'},                                                
      operator: 'EQUAL',                                                        
      value: {stringValue: phone}                                               
    }                                                                           
  }                                                                             
};                                                                              
db.runQuery({                                                            
    query: userExistenceCheckQuery,                                             
  }).execute(function(err, result) {                                            
    if(err) {console.log(JSON.stringify(err, null, '  '));}                     
    else {console.log(JSON.stringify(result, null, '  '));}                     
  });

Output:

Entered app
Imported gcloud

/home/gautham/node_modules/gcloud/lib/datastore/entity.js:542
  query.projection = q.selectVal.map(function(v) {
                                 ^
TypeError: Cannot call method 'map' of undefined
    at Object.queryToQueryProto (/home/gautham/node_modules/gcloud/lib/datastore/entity.js:542:34)
    at Dataset.DatastoreRequest.runQuery (/home/gautham/node_modules/gcloud/lib/datastore/request.js:375:19)
    at Object.<anonymous> (/home/gautham/app.js:19:4)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

Other relevant information:

node.js version is v0.10.33

Is there something I am doing wrong or is this a bug in the library ?

Activity

Next
  1. stephenplusplus commented on Mar 5, 2015

    @stephenplusplus
    stephenplusplus
    on Mar 5, 2015
    Contributor
    More actions

    This looks like code that the google-apis library expects (@ryanseys?)

    This same thing in our library should look something like:

    'use strict';
    console.log('Entered app');
    var gcloud = require('gcloud');
    console.log('Imported gcloud');
    var db = gcloud.datastore.dataset({
      projectId: "<my actual project ID>"
    });
    var phone = '000000';
    var userExistenceCheckQuery = db
      .createQuery('User')
      .filter('phone =', phone);
    
    db.runQuery(userExistenceCheckQuery, function(err, result) {
      if(err) {console.log(JSON.stringify(err, null, '  '));}
      else {console.log(JSON.stringify(result, null, '  '));}
    });
  2. stephenplusplus commented on Mar 5, 2015

    @stephenplusplus
    stephenplusplus
    on Mar 5, 2015
    Contributor
    More actions

    Feel free to re-open if you have any issues with our API. (Docs here: https://googlecloudplatform.github.io/gcloud-node/#/docs/v0.12.0/datastore/query)

  3. stephenplusplus
    closed this as completedon Mar 5, 2015
  4. ryanseys commented on Mar 5, 2015

    @ryanseys
    ryanseys
    on Mar 5, 2015
    Contributor
    More actions

    Yeah the generic library (google-api-nodejs-client) accepts this more generic form of a query object. Within gcloud-node we try to maintain a more idiomatic approach which is the reason for the more simplified and understandable api. Hope you find you like it more than the generic library! :)

  5. jgeewax
    added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    api: datastoreIssues related to the Datastore API.
    on May 14, 2015
  6. jgeewax
    added this to the Datastore Future milestone on May 14, 2015
  7. jgeewax
    added
    invalid
    on May 14, 2015
  8. yoshi-automation
    added
    🚨This issue needs some love.
    triage meI really want to be triaged.
    on Apr 6, 2020
  9. JustinBeckwith
    assigned
    stephenplusplus
    on Feb 1, 2021
  10. sofisl
    added a commit that references this issue on Sep 15, 2022

    docs: add links to the CHANGELOG from the README.md for Java and Node (…

    2de283e
  11. sofisl
    added a commit that references this issue on Sep 27, 2022

    chore: release 3.0.0 (#424)

    16842c1
  12. sofisl
    added 2 commits that reference this issue on Nov 9, 2022

    chore: release 3.0.0 (#424)

    0c708cc

    build: use gapic-generator-typescript v1.0.7. (#424)

    0a8968a
  13. 8 remaining items

  14. GautamSharda
    added 2 commits that reference this issue on Jan 20, 2026

    fix(docs): link to Stackdriver Error Reporting (#424)

    df796ed

    fix(docs): link to Stackdriver Error Reporting (#424)

    5ae00f5
  15. sofisl
    added 3 commits that reference this issue on Jan 27, 2026

    chore: silence ubuntu deprecation warnings (#424)

    bee74b9

    chore: silence ubuntu deprecation warnings (#424)

    a238b41

    chore: silence ubuntu deprecation warnings (#424)

    8e40644
  16. GautamSharda
    added a commit that references this issue on Feb 2, 2026

    fix(docs): link to Stackdriver Error Reporting (#424)

    b613618
  17. sofisl
    added a commit that references this issue on Feb 3, 2026

    build!: upgrade engines field to >=8.10.0 (#424)

    7afbc71
  18. GautamSharda
    added 2 commits that reference this issue on Feb 3, 2026

    fix(docs): link to Stackdriver Error Reporting (#424)

    d10fb6a

    chore(deps): update dependency eslint-plugin-node to v11 (#424)

    ccc5615
  19. GautamSharda
    added a commit that references this issue on Feb 23, 2026

    chore(deps): update dependency eslint-plugin-node to v11 (#424)

    807e73c
  20. sofisl
    added a commit that references this issue on Feb 25, 2026

    chore: convert system tests to typescript (#424)

    c60559e
  21. GautamSharda
    added a commit that references this issue on Feb 26, 2026

    chore(deps): update dependency eslint-plugin-node to v11 (#424)

    92ce1bb
  22. GautamSharda
    added 2 commits that reference this issue on Mar 5, 2026

    test: reap deleted resources to avoid collisions (#424)

    56ccedc

    build: add new kokoro config for coverage and release-please (#424)

    54a2c02
  23. thiyaguk09
    added a commit that references this issue on Mar 18, 2026

    chore: convert system tests to typescript (googleapis#424)

    80ad196
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @stephenplusplus
    stephenplusplus

Labels

🚨This issue needs some love.api: datastoreIssues related to the Datastore API.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    • Datastore FutureNo due date

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.