Synchronous function returns no value unless await
Hello everyone,
I'm encountering a confusing issue while working with Hono.js. In my project, I have a function named getEbayAuthUrl which is not defined as an async function and simply returns a string, e.g., "hi". However, I've noticed that if I do not use await when calling this function, the value doesn't seem to be processed correctly, as if it were missing in subsequent database operations.
Here's a simplified version of the function:
It doesn’t work as expected, and it seems like the value isn't recognized in subsequent database operations.
VS.
I thought await was only necessary for functions returning Promises. Does anyone know why I would need to use await here even though the function doesn’t return a Promise? Is this something specific to Hono.js, or is there a general JS principle I’m missing?
I'm encountering a confusing issue while working with Hono.js. In my project, I have a function named getEbayAuthUrl which is not defined as an async function and simply returns a string, e.g., "hi". However, I've noticed that if I do not use await when calling this function, the value doesn't seem to be processed correctly, as if it were missing in subsequent database operations.
Here's a simplified version of the function:
It doesn’t work as expected, and it seems like the value isn't recognized in subsequent database operations.
VS.
I thought await was only necessary for functions returning Promises. Does anyone know why I would need to use await here even though the function doesn’t return a Promise? Is this something specific to Hono.js, or is there a general JS principle I’m missing?