Hi everybody, I'm new in this kind of platform (cloud) and I have a problem 
with App Engine.

I have the following project structure in App Engine:

- Root
  - nodejs-docs-samples
  - src
    - be-nodejs-piloto
       - node_modules
       - api.js (api post uri)
       - app.js (main)
       - app.yaml
       - datastore-quickstart.json
       - package-lock.json
       - package.json
    - vibrant-tree-191664


app.yaml (content)
runtime: nodejs
env: flex

manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10

api.js (content)
'use strict';

// Load libs.
var express  = require('express');
var router   = express.Router();
var path = require('path');

const Datastore = require('@google-cloud/datastore'); // Imports the Google 
Cloud client lib

// Your Google Cloud Platform project ID
const projectId   = 'datastore-quickstart-191515';
const keyFilename = 
'/home/testcloud99/src/be-nodejs-piloto/datastore-quickstart-5672f2cde8ca.json';

console.log('keyFilename:' + keyFilename);

// Creates a client
const datastore = new Datastore({
    projectId: projectId,
    keyFilename: keyFilename
  });


router.route('/api/piloto')

    .post(function (req, res)
    {
    console.log('method: POST');

        // Read params
        var pMsgId   = req.body.msgId;

        const query = datastore.createQuery('MyEntity');
        query.filter('msgId', '=', pMsgId);

        // exec query
        datastore
            .runQuery(query)
            .then(results => {

                //OK
                return res.status(200).jsonp({
                    "piloto":
                    {
                        "code" : 0,
                        "desc" : "ok",
                    }
                });

        })
        .catch(err => {
            console.error('ERROR:', err);
            return res.status(200).jsonp({
                "piloto":
                {
                    "code" : 1,
                    "desc" : "error",
                    "errorMessage" : err.message
                }
                });
        });

    });

module.exports = router;

So, when I send a POST message (using soapUI), I get this response:

{"piloto": {
   "code": 1,
   "desc": "error",
   "errorMessage": "ENOENT: no such file or directory, open 
'/home/megagecs/src/be-nodejs-piloto/datastore-quickstart-5672f2cde8ca.json'"
}}

I guess App Engine isn't recognizing that JSON file but I don't know why. 
Any kind of configuration that should be done?

Hope you can help me.

Regards.




-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/8e51ba6b-0b5d-4556-a8a5-9419237348c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • [google-appengine]... Giancarlo C.

Reply via email to