Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

way to access credentials from environment for mongo-db node #35

Open
fraggys opened this issue Feb 6, 2016 · 9 comments
Open

way to access credentials from environment for mongo-db node #35

fraggys opened this issue Feb 6, 2016 · 9 comments

Comments

@fraggys
Copy link

fraggys commented Feb 6, 2016

Mongo-db node is not persisting db credentials in database, each time i restart the credentials of mongodb gets lost. (I am using mongo by compose on bluemix to save flows)

@knolleary
Copy link
Contributor

Could you provide some more details on your setup? I assume you are using a custom storage plugin to save your flows in mongo, rather then the cloudant plugin we provide? And that plugin is being provided its credentials via your settings file?
If it is failing to store credentials you set in the editor, that sounds like a bug with the storage plugin you are using.

@fraggys
Copy link
Author

fraggys commented Feb 9, 2016

I've only mongo db in my setup. I am saving flows and application data both in the same mongodb. For that aspect I've used, mongostorage.js instead of couchstorage.js.
Setup is like below-

  1. I started with node.js boilerplate app backed by mongodb.
  2. Integrated NODE-RED within that app.
  3. Used mongostorage.js to work with NODE-RED and I am able to save my flows/library functions in mongodb.
  4. Now on my flow editor, I am using Mongo-db node to save my application data in the same mongodb which i just integrated and I am giving credentials inside the monog-db node.

Issue I am facing is when I restart my app, my db-credentials are lost and my API's stop working.
Mongo-db node is not persisting credentials along with flows data in db.

@knolleary
Copy link
Contributor

Ok, so this sounds like a bug in mongostorage.js - it isn't routinely used anywhere since we replaced it with the Cloudant based plugin. Are there any error messages in the log when you deploy? Are you able to look at the database contents to see if the credentials are getting saved as you'd expect to determine if its a saving or loading issue.

@fraggys
Copy link
Author

fraggys commented Feb 9, 2016

In the database credentials are not stored. So its a saving issue and not a loading issue.

@knolleary
Copy link
Contributor

Can you try to save some credentials in another node type - for example, the HTTP Request node lets you provide a username/password.

@fraggys
Copy link
Author

fraggys commented Feb 9, 2016

Ok http-request node is not letting me deploy with credentials. Getting following error.

2016-02-09T21:36:47.64+0530 [App/0] OUT 9 Feb 16:06:47 - [warn] Error saving flows: The dotted field '419575e3.be6a8c' in 'credentials.419575e3.be6a8c' is not valid for storage. 2016-02-09T21:36:47.64+0530 [App/0] OUT 9 Feb 16:06:47 - [warn] MongoError: The dotted field '419575e3.be6a8c' in 'credentials.419575e3.be6a8c' is not valid for storage. 2016-02-09T21:36:47.64+0530 [App/0] OUT at Function.MongoError.create (/home/vcap/app/node_modules/mongodb/node_modules/mongodb-core/lib/error.js:31:11) 2016-02-09T21:36:47.64+0530 [App/0] OUT at toError (/home/vcap/app/node_modules/mongodb/lib/utils.js:114:22) 2016-02-09T21:36:47.64+0530 [App/0] OUT at /home/vcap/app/node_modules/mongodb/lib/collection.js:985:67 2016-02-09T21:36:47.64+0530 [App/0] OUT at handler (/home/vcap/app/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset.js:378:5) 2016-02-09T21:36:47.64+0530 [App/0] OUT at /home/vcap/app/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:780:13 2016-02-09T21:36:47.64+0530 [App/0] OUT at Callbacks.emit (/home/vcap/app/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:95:3) 2016-02-09T21:36:47.64+0530 [App/0] OUT at null.messageHandler (/home/vcap/app/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:249:23) 2016-02-09T21:36:47.64+0530 [App/0] OUT at Socket.<anonymous> (/home/vcap/app/node_modules/mongodb/node_modules /mongodb-core/lib/connection/connection.js:265:22) 2016-02-09T21:36:47.64+0530 [App/0] OUT at Socket.emit (events.js:107:17) 2016-02-09T21:36:47.64+0530 [App/0] OUT at readableAddChunk (_stream_readable.js:163:16) 2016-02-09T21:36:47.64+0530 [App/0] OUT at Socket.Readable.push (_stream_readable.js:126:10) 2016-02-09T21:36:47.64+0530 [App/0] OUT at TCP.onread (net.js:540:20)

@fraggys fraggys closed this as completed Feb 9, 2016
@fraggys fraggys reopened this Feb 9, 2016
@knolleary
Copy link
Contributor

Great - that's the bug then. The mongostorage plugin is quite old and unloved - really should move it out to its own repo so it can be maintained properly

@purval
Copy link

purval commented Jun 8, 2016

Is there a solution for this problem?
I have a similar setup like Fraggys. I am using mongodb for storing data as well as node red flow.
When I am trying to use http request node, it gives me the same error as fraggy has provided in the previous comment.

@knolleary
Copy link
Contributor

@purval you'll need to patch mongostorage.js so it doesn't try to use keys with . in their name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants