title: node.js crypto pbkdf2 return undefined
body: <pre><code>export const upgradeBase64crypto = (password) =&gt; {
      crypto.randomBytes(64, (err, buf) =&gt; {
          const salt = buf.toString(&quot;base64&quot;);
        
          crypto.pbkdf2(password, salt, 100, 64, &quot;sha512&quot;, (err, key) =&gt; {
              return key.toString(&quot;base64&quot;);
          });
      });
  };
  
  import { upgradeBase64crypto } from &quot;../../../utils/pwCrypto&quot;;
  
  export default {
      Mutation: {
          signUpUser: async (_, args, { request, query }) =&gt; {
              try {
                  const param = args.param;
                  let pw = upgradeBase64crypto(param.pw);
                
                  console.log(pw);
              } 
            catch (err) {}
          },
      },
  };
  </code></pre>
  <p>When running <code>console.log(key.toString('base64'))</code> in <code>upgradeBase64crypto</code>, the normally encrypted string appears in the log. However, running <code>return key.toString('base64')</code> returns <code>undefined</code>. What's the problem?</p>