I want to use the memcache AppEngine service in my NodeJS flexible environment. As specified in the documentation: https://cloud.google.com/appengine/docs/flexible/nodejs/using-redislabs-memcache
I used the suggested app.yaml file and I decommented the USE_GAE_MEMCACHE: 1
and commented the other variables. But when I run my deploy command it fails with this error:
net.js:1048
throw new RangeError('"port" option should be >= 0 and < 65536: ' + port);
^
RangeError: "port" option should be >= 0 and < 65536: NaN
at lookupAndConnect (net.js:1048:13)
at Socket.connect (net.js:1021:5)
at Object.connect (net.js:113:35)
at Server.sock (/app/node_modules/memjs/lib/memjs/server.js:120:24)
at Server.write (/app/node_modules/memjs/lib/memjs/server.js:219:8)
at handleFlush (/app/node_modules/memjs/lib/memjs/memjs.js:620:10)
at Client.flush (/app/node_modules/memjs/lib/memjs/memjs.js:624:5)
at MemcachedDriver.flush (/app/data_manager/memcached_driver.js:42:17)
at Storage.intialize (/app/data_manager/storage.js:45:12)
at Object.<anonymous> (/app/app.js:22:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! waternamics@1.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the waternamics@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-07-26T14_39_48_624Z-debug.log
When I log the MEMCACHE_URL
variable it says: undefined:undefined
Here's the code I am using to connect to memcache:
let MEMCACHE_URL = process.env.MEMCACHE_URL || '127.0.0.1:11211';
if (process.env.USE_GAE_MEMCACHE) {
MEMCACHE_URL = `${process.env.GAE_MEMCACHE_HOST}:${process.env.GAE_MEMCACHE_PORT}`;
}
this.client = Memcached.Client.create(MEMCACHE_URL);
I don't know why it didn't work, It specs in the documentation that it's in alpha but it should work no ?