# can we use sync-request module in apigee?

**URL:** <https://discuss.google.dev/t/can-we-use-sync-request-module-in-apigee/7403>\
**Category:** Apigee\
**Tags:** api-runtime\
**Created:** [June 28, 2016, 9:02am UTC](https://discuss.google.dev/t/can-we-use-sync-request-module-in-apigee/7403 "2016-06-28T09:02:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [June 28, 2016, 9:02am UTC](https://discuss.google.dev/t/can-we-use-sync-request-module-in-apigee/7403/1 "2016-06-28T09:02:25Z")

</div>

Hi guys, currently im on mobile so just want to know if we can use **sync-request** node module in edge node programs?

It is not mentioned here,

[http://docs.apigee.com/api-services/content/understanding-edge-support-nodejs-modules](http://docs.apigee.com/api-services/content/understanding-edge-support-nodejs-modules)

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [June 28, 2016, 6:30pm UTC](https://discuss.google.dev/t/can-we-use-sync-request-module-in-apigee/7403/2 "2016-06-28T18:30:28Z")

</div>

As no one answered here, I have tried this and yes we can use `sync-request` module in Apigee Nodejs.

We need to create a package.json as,

```auto
{
    "name":"usergrid-node",
    "version":"0.0.0",
    "description":"description",
    "main":"name",
    "dependencies": {
        "sync-request":"2.2.0",
        "usergrid":"0.10.11"
        
    }
}

```

Note- First I have used `latest` for sync-request, but an error was thrown as,

```auto
Error: Sync-request requires node version 0.12 or later. If you need to use it with an older version of node
you can `npm install sync-request@2.2.0`, which was the last version to support older versions of node.
    at doRequest (/organization/environment/api/node_modules/sync-request/index.js:15)
    at /organization/environment/api/s.js:148
    at callbacks (/node_modules/express/lib/router/index.js:164)
    at param (/node_modules/express/lib/router/index.js:138)
    at pass (/node_modules/express/lib/router/index.js:145)
    at /node_modules/express/lib/router/index.js:90
    at router (/node_modules/express/lib/router/index.js:33)
    at next (/node_modules/express/node_modules/connect/lib/proto.js:193)
    at multipart (/node_modules/express/node_modules/connect/lib/middleware/multipart.js:93)
    at /node_modules/express/node_modules/connect/lib/middleware/bodyParser.js:64
    at urlencoded (/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js:38)
    at /node_modules/express/node_modules/connect/lib/middleware/bodyParser.js:62
    at /node_modules/express/node_modules/connect/lib/middleware/json.js:81
    at onEnd (/node_modules/express/node_modules/connect/node_modules/raw-body/index.js:109)
    at g (events.js:180)
    at emit (events.js:92)
    at _stream_readable.js:943
    at _tickDomainCallback (trireme.js:491)
    at _tickFromSpinner (trireme.js:422)

```

So that is the reason I used `2.2.0` in package.json.

I have added this module and but did not use it, because the time taken to get the response was too high and hence results in Script timeout.

Once we add the above thing, we need to install the module. This can be done through Apigee Management APIs,

[Manage Node Packaged Modules](http://docs.apigee.com/management/apis/post/organizations/%7Borg_name%7D/apis/%7Bapi_name%7D/revisions/%7Brevision_num%7D/npm-0)

Follow the instructions there and use these commands,

`command=ls `Returns a list of Node.js dependencies.

`command=install`Installs all dependencies for the `resources/node` directory.

After this you need to re-deploy your proxy.

I hope this helps someone in the future.

---

<div class="post-metadata">

**Author:** ![anilsr](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@anilsr](https://discuss.google.dev/u/anilsr)\
**Post date:** [June 29, 2016, 6:38am UTC](https://discuss.google.dev/t/can-we-use-sync-request-module-in-apigee/7403/3 "2016-06-29T06:38:41Z")

</div>

Absolutely it helps [@Barahalikar Siddharth](https://community.apigee.com/users/1205/siddharth-b.html) , Thank you for sharing solution with community. Way to go !!
