first then () I do not return any value, so I am surprised that this is a function in the first, and then () is called before the function in the next then ().
Yes it is. (This can be trivially verified with a debugger.)
It does not matter that it does not return a value; which is actually the same as doing return undefined . Thus, the next callback in the chain will see undefined as the permission value, but since this next callback does not care about the permission value, this is fine.
Here is a simple example demonstrating this:
Promise.resolve("a") .then(result => { console.log("First callback got: " + result);
source share