cloudfoundry-community / node-cfenv

easy access to your Cloud Foundry application environment for node
Apache License 2.0
73 stars 20 forks source link

Not able to use cfenv. Throws Join error #43

Closed rv97 closed 4 years ago

rv97 commented 4 years ago

When i try to import cfenv (just import) using var cfenv = require('cfenv'), it throws this error. Uncaught TypeError: Arguments to path.join must be strings at index.js:117 at Array.filter () at r (index.js:287) at Object.t.join (index.js:115) at o (index.js:62) at Object. (index.js:13) at Object. (2.3e249b83.chunk.js:2) at a ((index):1) at Object. (cfenv.js:13) at Object. (cfenv.js:314)

I didn't even start using it. Can you please look into it.

pmuellr commented 4 years ago

Given the file names (2.3e249b83.chunk.js:2) and function names (r, o, a) in the stack trace above, and the format of the stack trace, it looks like you are trying to use cfenv in a browser. cfenv can't be used in a browser, it's only useful in a node.js application.

rv97 commented 4 years ago

Actually my requirement is, i have a react app running express server. That react app needs to access the services connected to the app like destination, connectivity and xsuaa via the environment variables. Is there any way to proceed?

pmuellr commented 4 years ago

Sorry, I can't really help with that. Suggest you post a question on a react forum / mailing list.