title: API resolved without sending a response for /api/users/create, this may result in stalled requests. NEXTJS
body: <p>I created an API endpoint to handle user account creation in my Next.js app, and I am using <a href="http://knexjs.org" rel="nofollow noreferrer">knex.js</a> to handle my queries, but I still get this error:</p>
  <blockquote>
  <pre><code>API resolved without sending a response for /api/users/create, this may result in stalled requests.
  </code></pre>
  </blockquote>
  <p>My code in <code>/pages/api/users/create.js</code>:</p>
  <pre class="lang-js prettyprint-override"><code>import { hash } from 'bcrypt';
  import knex from '../../../knex';
  
  export default async function regiterUser(req, res) {
    if (req.method === 'POST') {
      try {
        hash(req.body.password, 10, async function (_, hash) {
          await knex('users').insert({
            name: req.body.name,
            email: req.body.email,
            role: 'user',
            allowed: true,
            password: hash,
          });
          res.end();
        });
      } catch (err) {
        res.status(err).json({});
      }
    } else {
      res.status(405);
    }
  }
  </code></pre>