You're viewing **Apigee Edge** documentation.  
[Go to the
**Apigee X** documentation](http://cloud.google.com/apigee/docs/api-platform/troubleshoot/playbooks/troubleshooting-apigee-hybrid). info

> [!WARNING]
> **Private Cloud Deprecation Notice:**
>
> **Support for [Node.js](https://docs.apigee.com/api-platform/nodejs/overview-nodejs-apigee-edge) proxies
> and [secure vaults](https://docs.apigee.com/api-platform/nodejs/using-secure-store)**
>
> Since 2013, Apigee has supported the
> [use of Node.js proxies within Apigee
> Edge](https://www.programmableweb.com/news/apigee-api-platform-now-supports-node.js-allowing-developers-to-build-highly-customized-apis-and-apps/brief/2013/10/25) through the use of [Trireme](https://github.com/apigee/trireme), which enables you to run your Node.js code
> within Apigee Edge for Private Cloud and expose it as an API.
>
>
> Apigee recommends Private Cloud customers take the following steps:
>
> - Migrate data in secure vaults to [Encrypted Key Value Maps](https://docs.apigee.com/api-platform/cache/key-value-maps#aboutencrypted) (KVM) to access sensitive data from an API proxy.
> - Migrate Trireme (Node.js) based API proxies to a native Node.js environment outside of Apigee.
>
>
> See also [Apigee deprecations and retirements](https://docs.apigee.com/release/deprecated-features).

> [!WARNING]
> **Public Cloud Retired feature:** The traditional, Trireme-based
> Node.js support on Apigee Edge Cloud is retired and, by extension,
> [apigee-access](https://docs.apigee.com/api-platform/nodejs/using-apigee-access) is also
> retired because it is only used in Trireme-based Node.js applications deployed on Apigee Edge.
> Trireme-based Node.js was retired on October 10, 2019. See
> [Trireme-based Node.js End of Life](https://docs.apigee.com/release/notes/trireme-nodejs-eol).

It's a good practice to make sure any Node.js code you add to a proxy works before you deploy
it to Edge. This topic discusses ways to debug and troubleshoot proxies that include Node.js
applications after they are deployed.

## Increasing connection pool size to
improve performance

If you notice slow performance, you may be able to solve the problem by increasing the default
Node.js connection pool size with [maxSockets](https://nodejs.org/docs/v0.10.38/api/http.html#http_agent_maxsockets), or
by [disabling
socket pooling](https://nodejs.org/docs/v0.10.38/api/http.html#http_class_http_agent) altogether. For more information and example code, see [Node.js
Performance Tips: Socket Pooling](https://discuss.google.dev/t/node-js-performance-tips-socket-pooling/17495) in the Apigee Community.

## Viewing Node.js logs

To view log information about your Node.js application:

1. In the main API proxies page, click on the proxy you wish to view.
2. In the summary page of the selected proxy, click **Node.js Logs** on the right-hand side of the tool bar.

> [!NOTE]
> **Note:** The Node.js Logs button does not appear for non-Node.js API proxies.

In the Logs page, you can select a time range of logs to view, as shown below. The logs record
HTTP method calls, success or failure of calls, console.log messages, and so on. Enter a search
string in the search field to display all log entries that contain the string.

![](https://docs.apigee.com/static/api-platform/images/node-log-window.png)

## Using the trace tool

The trace tool is useful for general proxy debugging. For detailed information on using the
trace tool, see [Using the Trace
tool](https://docs.apigee.com/api-platform/debug/using-trace-tool-0).

## Printing console output

You can embed console.log statements in your Node.js code and view the output in the trace
tool. For example, the following statement prints the value of the variable
**config.user**:

```javascript
console.log('Logging in as %s', config.username);
```

![](https://docs.apigee.com/static/api-platform/images/node-console-log.png)

To view the output of console.log messages in the trace tool, call
your API in the Trace Tool and click **Output from all Transactions**to
open the output panel:

![](https://docs.apigee.com/static/api-platform/images/output-transactions.png)

Assuming you executed the following code...

```javascript
var http = require('http');

console.log('node.js application starting...');

var svr = http.createServer(function(req, resp) {
    resp.end('Hello, World!');
});

svr.listen(9000, function() {
    console.log('Node HTTP server is listening');
});
```

... the console statements appear in the panel:

![](https://docs.apigee.com/static/api-platform/images/output-transactions-open.png)

## Configuring Nginx target timeout settings

If you are using Nginx as a proxy and see "Bad Gateway" errors, try increasing the Nginx proxy
timeout configuration as explained here:

- <http://www.nginxtips.com/504-gateway-time-out-using-nginx>
- [http://wiki.nginx.org/HttpProxyModule](https://wiki.nginx.org/HttpProxyModule)

For example:

```javascript
proxy_connect_timeout       60;
proxy_read_timeout          120;
```

Depending on how long the server takes to respond can determine your ideal timeout
configurations. For example, a read timeout of 45-60 seconds might be ideal to provide a
reasonable buffer.

## Configuring Apigee target timeout settings

You can also configure the Apigee default timeout values in the HttpTargetConnection element
in the TargetEndpoint. The default values are:

```javascript
connect.timeout.millis - 60 seconds
io.timeout.millis - 120 seconds
```

```javascript
<HTTPTargetConnection>
    <Properties>
        <Property name="connect.timeout.millis">5000</Property>
        <Property name="io.timeout.millis">5000</Property>
    </Properties>
    <URL>http://www.google.com</URL>
</HTTPTargetConnection>
```

See also [Endpoint properties reference](https://docs.apigee.com/api-platform/reference/endpoint-properties-reference).

## For more information

To learn more about debugging, see:

- [Using the Trace tool](https://docs.apigee.com/api-platform/debug/using-trace-tool-0)
- [Using performance
  metrics](https://docs.apigee.com/api-platform/analytics/using-performance-metrics)
- [Troubleshooting
  introduction](https://docs.apigee.com/api-platform/troubleshoot/troubleshooting-introduction)
- [Audits: API, Product, and organization
  history](https://docs.apigee.com/api-platform/debug/view-api-history)

## Next steps

For information about Node.js module support in Apigee Edge, including information about
support for HTTP/HTTPS, TLS, and other advanced topics, see [Understanding Edge support
for Node.js modules](https://docs.apigee.com/api-platform/nodejs/understanding-edge-support-nodejs-modules).