0

I've read all the Promise posts and still can't get this right. No matter what way I write it, I get a " Promise { }". How do I write this statement to get the promise result, not pending.

`let jws = jose.JWS.createSign({ format: 'compact', fields }, signingKey)
.update(Buffer.from(compressedPayload))
.final()
.then(function(result) {
    jws = result;
    });

var myjws = jws.then(function(result){ return jws});
console.log("My JWS is:", myjws)'




My JWS is: Promise { <pending> }

What am I doing wrong? Thanks

  • Does this answer your question? [How to return the response from an asynchronous call](https://stackoverflow.com/questions/14220321/how-to-return-the-response-from-an-asynchronous-call) – Evert Feb 06 '22 at 05:59
  • Move 'console.log' inside the callback you're passing to `.then()` – Evert Feb 06 '22 at 06:00

0 Answers0