# Issue using "require" in bluemix function nodes

**URL:** <https://discourse.nodered.org/t/issue-using-require-in-bluemix-function-nodes/8005>\
**Category:** General\
**Created:** [15 February 2019 11:10 UTC](https://discourse.nodered.org/t/issue-using-require-in-bluemix-function-nodes/8005 "2019-02-15T11:10:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![etawyy](https://avatars.discourse-cdn.com/v4/letter/e/7bcc69/32.png) [@etawyy](https://discourse.nodered.org/u/etawyy)\
**Post date:** [15 February 2019 11:10 UTC](https://discourse.nodered.org/t/issue-using-require-in-bluemix-function-nodes/8005/1 "2019-02-15T11:10:01Z")

</div>

Hi, I have followed a couple of tutorials to add a require in bluemix function node, in particular: [https://nodered.org/docs/writing-functions.html](https://nodered.org/docs/writing-functions.html)

In my case, I need to have not just a require but also with parameters (?) :  
var ovh = require('ovh')({  
appKey: 'your\_app\_key',  
appSecret: 'your\_app\_secret',  
consumerKey: 'your\_consumer\_key'  
});

This works perfectly fine on a local instance of node.js....

With bluemix, I have added in bluemixsettings:  
functionGlobalContext: {  
ovh:require('ovh')({  
endpoint: 'ovh-eu',  
appKey: 'key',  
appSecret: 'key',  
consumerKey: 'key'  
})  
},

and in my function node I call:  
var ovh = global.get('ovh');  
ovh.request('GET', '/sms', function (err, serviceName) (... etc etc )

when injecting, the node says: "TypeError: Cannot read property 'request' of undefined"  
So ovh doesn't get defined properly, I guess.  
I have tried to put the variables in the function node instead of bluemixsettings, with no more success. "ovh is not a function"

Can anyone help? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![ernestgwilsonii](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ernestgwilsonii/32/9387_2.png) [@ernestgwilsonii](https://discourse.nodered.org/u/ernestgwilsonii)\
**Post date:** [14 July 2019 10:42 UTC](https://discourse.nodered.org/t/issue-using-require-in-bluemix-function-nodes/8005/2 "2019-07-14T10:42:38Z")

</div>

Did this ever get solved?  
I am still seeing similar.

---

<div class="post-metadata">

**Author:** ![etawyy](https://avatars.discourse-cdn.com/v4/letter/e/7bcc69/32.png) [@etawyy](https://discourse.nodered.org/u/etawyy)\
**Post date:** [16 January 2020 08:06 UTC](https://discourse.nodered.org/t/issue-using-require-in-bluemix-function-nodes/8005/3 "2020-01-16T08:06:21Z")

</div>

Hi,

Yes. In my case, it was a beginners issue. I THOUGHT I was modifying bluemixsettings with the above code.  
I was not actually. Misuse of the bluemix provided code editor.  
Once I updated the code correctly, it worked.
