Hosted Targets FAQ (Beta)

Beta FAQ

How do I provide feedback or get support?

If you questions about Hosted Targets, please ask on the Apigee Community.

Is there management API support for Hosted Target proxies?

No new management APIs were created or existing APIs changed to support Hosted Targets; however, you can use existing management APIs to deploy and manage proxies that use Hosted Targets, as long as the Hosted Target proxies are properly constructed.

When working with Hosted Target proxies, you need to know the following requirements:

  • Hosted Target source code must be placed in the resources/hosted directory.
  • A resources/hosted/app.yaml manifest file.
  • A package.json file that includes any package dependencies for your Node.js app.
  • If your application contains any custom modules not available through npm, then you must also include them in a node_modules directory in your proxy's resources/hosted directory.

Example proxy file structure for a Hosted Targets proxy:

apiproxy/
         policies/
         proxies/
         targets/
         resources/
           hosted/
             app.yaml
             package.json
             node_modules or node-modules-{module name}.zip (required only if you must include custom modules)
             Your application code

For details on creating Hosted Targets proxies, see the Tutorials.

Can I use IP whitelisting to secure my target backend?

IP whitelisting is documented in a Google Cloud Knowledge Base entry. We realize this might not be exactly what you’re use to and are interested in hearing your feedback.

Can I put multiple <HostedTarget> target endpoints in one proxy

You can specify multiple <HostedTarget> elements in the target endpoint of a proxy; however, only one Hosted Target is deployed per proxy. This is the application in the proxy's resources/hosted directory. Any route rules to different instances of <HostedTarget> will route them to the same deployed Hosted Target application.

How should we work around the lack of apigee-access?

apigee-access is not supported in the Beta release of Hosted Targets and while we plan on having an answer to this in future releases, we realize that existing Node.js on Edge customers might have some applications that will not run on Hosted Targets. The suggestion right now is to use whatever Edge APIs and policies are available to replace what your existing code does using apigee-access. Where that might not be possible, we do have a few workarounds that will work for now:

  • Use headers - You can put KVM values or flow variables into headers and those headers can be consumed by your application at runtime.
  • Use environment variables - You can set environment variables whose values are provided by the KVM. This is documented in the manifest file portion of the user guide.

Can I use Java Keystores (JKS) Files for TLS?

No, Hosted Targets does not support JKS for TLS as a replacement for PEM files, see previous documentation here. Hosted Targets uses native Node.js and thus uses OpenSSL natively. Please refer to the TLS (SSL) documentation provided by Node.js docs when setting up TLS/SSL connections.

Always delete temporary files

Local disk storage in the temporary directory is an in-memory filesystem. All files that you write consume memory available to your function. Files that you write are usually available at consecutive invocations, therefore failing to delete these files may eventually lead to an out-of-memory error and a subsequent cold start.

Do not attempt to write outside of the temporary directory. Also, use platform-independent methods such as os.tmpdir() and path.join() to construct the temporary file path, so that your functions also work on the emulator on any platform.

For more information, see this Google Cloud document.

Deploying multiple proxy revisions

Apigee Edge allows you to deploy multiple revisions of a proxy to an environment with different basepaths; however, this behavior is not supported for Hosted Targets. In future releases this situation will result in a deployment error.

Troubleshooting

Build/Deploy failed due to missing package.json

In the previous version of Node.js hosting a package.json file was optional. For Hosted Targets, this is required. Any attempt to create/deploy a proxy without a package.json will fail at build time.

Receiving 502 Bad Gateway From Proxy

A "502 Bad Gateway" error can occur when the process fails to start. To debug this check the runtime logs and look for error messages when starting. A common error is a missing or invalid start command in the package.json. At a minimum the package.json should specify "start": "node ." in the “scripts” property. For an example check out the package.json provided above.

Proxy Hangs and Returns 504 Gateway Timeout

A "504 Gateway Timeout" error can occur when the Hosted Targets target app does not respond within the timeout limits. Check to ensure your application is listening on the port set the environment variable PORT. You can access this variable with process.env.PORT in your application. Otherwise check the runtime logs for any other error messages.

Was this page helpful? Let us know how we did:

Send feedback about...

Apigee Docs