title: Hapi error: handler method did not return a value, a promise, or thrown an error
body: <p>I have a NodeJS application using Hapi on version 17 which consumes a web service which returns an image of a map, however, when run the code below I get the following error:</p>
  
  <pre><code>Debug: internal, implementation, error
      Error: handler method did not return a value, a promise, or throw an error
      at module.exports.internals.Manager.execute (C:\map\node_modules\hapi\lib\toolkit.js:52:29)
      at &lt;anonymous&gt;
      at process._tickCallback (internal/process/next_tick.js:188:7)
  </code></pre>
  
  <hr>
  
  <pre><code>var Hapi = require('hapi'),
  server = new Hapi.Server({
      host: '0.0.0.0',
      port: 8080,
      routes: {
          cors: true
      },
      SphericalMercator = require('sphericalmercator'),
      sm = new SphericalMercator({ size: 256 }),
      prequest = require('request').defaults({ encoding = null });
  
  var wmsUrl = "http://localhost:8088/service/wms?SERVICE=WMS&amp;REQUEST=GetMap&amp;VERSION=1.1.1&amp;STYLES=&amp;FORMAT=image%2Fpng&amp;HEIGHT=383&amp;WIDTH=768&amp;SRS=EPSG%3A3857";
  
  server.route({
      method: 'GET',
      path: '/{layers}/{z}/{x}/{y}.png',
      handler: async (request, h) =&gt; {
          var bbox = sm.bbox(request.params., request.params.y, request.params.z, false, '00000');
          var theUrl = `${wmsUrl}&amp;BBOX=${bbox.join(',')}&amp;LAYERS=${decodeURIComponent(request.params.layers)}`;
          prequest.get(theUrl, function (err, res, body) {
              h.response(body).header('Cache-Control'), 'public, max-age=2629000').header('Content-Type', 'image/png');
          });
      }
  });
  
  server.start();
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>I'm writing this in the phone as the PC I'm working with right now, has no internet access, if I missed something or misspelled anything because of auto corrector, feel free to point it and I'll edit it to correct it.</p>