Reputation: 365
I'm currently working on a google cloud project that involves moving data from PubSub to Datastore. This is being run on a google cloud appengine instance that is running as a resident application. I started working on the datastore part first with no trouble, but when it came to supporting pubsub the app crashes when I try to include it.
//including datastore
const Datastore = require('@google-cloud/datastore');
const datastore = Datastore();
//including pubsub
const PubSub = require('@google-cloud/pubsub');
const pubsub = new PubSub();
What I don't understand is how these two commands are practically identical and only the pubsub part crashes. The google-cloud documentation lays this out as the way to include pubsub into the project. I also tried loading the package locally through npm with no success.
What can be done to alleviate this issue? Thanks in advance.
Upvotes: 2
Views: 4320
Reputation: 365
I've found the source of the error. In the package.json file, I had forgotten to include pubsub as a dependency. The updated dependencies reads as follows
"dependencies": {
"@google-cloud/datastore": "1.3.4",
"@google-cloud/pubsub": "0.19.0",
"express": "4.16.2"
},
The app now deploys without any problems.
Upvotes: 7