-
Notifications
You must be signed in to change notification settings - Fork 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 ... how to build with babel #5
Comments
Where are you putting the async await functions? The npm package is pre-built before publishing to NPM, so it's not really a problem with this package. BTW @lorensr was thinking of working on a Meteor integration package as well! |
For example in following code it says: "Can't wait without fiber" on line with Meteor.user retrieval
|
It works fine here: https://github.com/apollostack/meteor-starter-kit/blob/master/server/main.js I guess you put this code into an NPM package, and it doesn't work anymore? The |
The previous code works flawlessly in Meteor, but when built as Npm package it fails. |
Ha! The Meteor polyfill will be the problem ... would you be able to point me out how can I use it with babel? |
You could just not use |
I'll try with atmosphere package. Good idea. I cannot work without async/await as all update / insert queries fail complaining that they do not run in Meteor Fiber. |
@tomitrescak Hi Tomas, here's the shell I made for the atmosphere package: https://github.com/apollostack/meteor-integration I'd be interested to hear your thoughts on the API: apollographql/meteor-integration#2 And would be happy to work on PRs with you if you'd like to combine efforts 😄 |
@lorensr looks great! I'll give it a go. My effort is not going very well. Just created the meteor package but am still getting "Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment." error. Wht I miss in the package is the possibility to incrementally add resolvers. In a complex application with 50+ queries it would be great to have a possibility to split queries and mutations by modules. That is one of the things I tried to implement, but am hitting the wall with async. I tried to look at how you've done it, but looks like you currently have only a shell, no implementation. So, when you start to implement "useMeteorAccounts" you probably will run into very same issue. There the error is "Cannot await when not in Fiber". |
Also, would be great if you would hide all NPM packages into the Meteor package so no Npm install would be necessary. My repo is here: |
Definitely DO NOT do this. The whole idea is that you can update the NPM package as necessary without waiting for the Meteor package maintainer to get around to updating their wrapper. |
You can use _.merge to combine as many resolver objects as you want. |
@stubailo ... just bumped into Meteor recommendation to NOT do that ;) |
What do you mean? |
I confirmed what you just said. I was checking the Meteor recommendations for package authors. |
The moment I moved all npm dependencies form package to root level the async problem disappeared, yet another one appeared as "context" is always null in my queries. This is how I init the server:
I'm sure that user is filled in. Then in my mutation:
The context is null. Do you have any idea why this could happen? [EDIT] Nevermind ... all solved. |
@lorensr I like the API, most of it is there. I'll try to do the PR tomorrow with what I've done. You'll see how much of it is trash. |
* Initial commit * 0.0.3 * Replace endOffset with duration in resolver calls * 0.0.4 * Fix duration * 0.0.5 * Remove unnecessary schema level resolve function and return schema * Update README * 0.0.6 * Update README * Update dependencies * 0.0.7 * Update README * set package.json to point to this repository (#3) * Update dependencies Fixes #4. * 0.0.8 * Add asynciterable support to tsconfig.json * Skip trace collection when context or context._traceCollector is undefined Fixes #5. * 0.0.9 * Rewrite to use graphql-extensions * 0.0.10 * 0.0.11 * 0.1.0 * Update graphql-extensions dependency and downgrade TS target * 0.1.1 * Update README * Update README * Increase version range for `graphql` peerDependency. (#7) * 0.1.2 * Update dependencies * 0.1.3 * [apollo-bot] Update the Issue/PR Templates with auto label (#9) * Update `graphql` peer dependency range to allow 0.13.x. * dev: Update TypeScript to latest version, v2.7.2. * dev: Update jest & dependencies to latest versions. * dev: Update type definitions for `graphql`, `node` and `jest`. * Allow `undefined` to return from `format`. (#12) * Allow `undefined` to return from `format`. TypeScript 2.7 introduced new "Strict Class Instantiation" rules which, as the name suggests, require properties which are intended to be set (eventually, to a type) be set during construction. Before this change, the `TracingExtension` class was deferred setting these private properties (namely, `startWallTime`, `endWallTime`, `startHrTime` and `duration`), but not during instantiation which required setting marking them as optional and guarding their usage in other methods which might use those (temporarily `undefined`, if even for a tick) properties. For example, the expectation that `format` is _only_ called after `requestDidStart` is not guaranteed with this configuration, even if it is expected under normal operation. Therefore, this change adds the additional guarding and updates the `format` method to return `undefined` in the event that it doesn't have the appropriate data. * Update `graphql-extensions` dependency to `~0.0.9`. Specifically, to take advantage of a type which landed in `graphql-extensions@0.0.9` thanks to https://github.com/apollographql/graphql-extensions/pull/10. * 0.1.4 * Update for graphql-extensions@0.1.0 API (#13) * Upgrade to TypeScript 2.8 * Add tslint and prettier * Update for graphql-extensions@0.1.0 API * 0.2.0-beta.0 * Make work with newest API usage format() now gets called before the requestDidStart() EndHandler. * 0.2.0-beta.1 * remove unused files from tracing package * upgrade packages, fix compilation bugs, and add test
…zers Improve snapshot serializer usage
…zers Improve snapshot serializer usage
Hi, I'm trying to build an NPM package that would provide some helper functions for meteor users. The issue is thta no matter how I build it from ES6/7 code, the async await functions always complain about fibers and they do not work.
What is the babel config that would work?
Here is my .bablerc
The text was updated successfully, but these errors were encountered: