Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @heroku/hapi-heroku-client with all npm packages installed. Try it out:

var hapiHerokuClient = require("@heroku/hapi-heroku-client")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@heroku/hapi-heroku-client v4.0.0

http client pre-configured to streamline interfacing with heroku's platform API

hapi-heroku-client Circle CI

a hapijs plugin mapping a heroku client to both and, the latter of which includes the incoming requests Authorization header. This project is based on wreck. See wreck's documentation for additional options and usages.


As of v4 4XX responses are treated as errors. If you're using this via promises (e.g.Bluebird.promisify) this is a non-trivial change. 4XX and 5XX responses will now trigger the .catch clause. This is further complicated in that Bluebird only passes error to catch and not response or body.


npm install --save hapi hapi-heroku-client
const Hapi = require('hapi');
const myServer = new Hapi.Server();

    register: require('hapi-heroku-client'),
    options: {
      /* options enumerated below */
      'timeout': 5000, /* for example */
      'user-agent': 'example-code-1.0.0' /* for another example */
], function (error) {

    if (error) { throw error; }

      method: 'get',
      path: '/foo',
      handler: function (request,reply) {
        const server = request.server;

        // fetch unauthenticated API endpoints'/version', (err, version) => {

        // or with promises'/version').then((version) => {

        // fetch authenticated API endpoint'/apps', (err, apps) => {

        // or with promises'/apps') => {

    myServer.start(() => { console.log('your server has started!'); });


  • host -- defaults to
  • proto -- defaults to https
  • timeout -- defaults to 15 seconds
  • variant -- defaults to 'application/vnd.heroku+json; version=3'
  • user-agent -- defaults to hapi-heroku-client


  • HEROKU_API_PROTO -- defaults to https
  • HEROKU_API_HOST -- defaults to
  • HTTP_TIMEOUT -- defaults to 15 seconds
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free