-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
async await broken in 1.6-beta.16 (Windows x64) #9002
Comments
wait -- we have to add an 'await' to the front of the function call if calling an async function? I thought we could do the following to make the async call: // module_a.js => Meteor server-side
let thing = {};
// regular, fibered, sync function
thing.getNewThing = userId => {
return thing;
}
// regular, fibered, sync function
thing.getThing = userId => {
return thing;
}
// => don't hold things up, so make async
thing.getExistingOrNewThingAsync = async userId => {
let things = null;
if (await thing.expiredOrNotExistsThing(userId)) {
// adding await to sync function
things = await thing.getNewThing(userId); // => regular sync function
return things;
}
else {
// adding await to sync function
things = await thing.getThing(userId); // => regular sync function
return things;
}
}
export { thing }; // login handler => server-side
import { thing } from 'imports/server/stuff/module_a';
Accounts.onLogin(user => {
const userId = user && user.user && user.user._id || '';
// don't want to hold up the login process on account of this function
thing.getExistingOrNewThingAsync(userId); // => no await here, but is called async
}); Please correct me here! |
A bit more debugging information: the error is thrown in the
@aadamsx If you don't |
@klaussner yep, in my case, in this situation, I don't care about the return value. |
Can we get a reproduction of this? Happy to take a look. |
@benjamn https://github.com/klaussner/meteor-issues/tree/9002 (with @jakobrosenberg's example) |
It does not seem possible to ensure that code after an await expression runs in a Fiber if we use native await expressions. However, Promise.await still works just fine. meteor/meteor#9002
This should be fixed if you run |
On Windows 10 x64 the following code works in a new Meteor project v1.5.1, but not v1.6-beta.16.
In the 1.6-beta.16 the code above produces the following error
Exception while invoking method 'findcar' Error: Can't wait without a fiber
The text was updated successfully, but these errors were encountered: