Closed rwaness closed 7 years ago
@rwaness Sorry for the delay, initAccounts might not be exported, or maybe not exist in the version of apollo-accounts you have installed. I can help you with that.
@dbrrt thanks for you answer.
So what should I do ?
@rwaness
I'm running this repository's code on a WIP Apollo/GraphQL based app, so it's working. Even tried with React Native.
Can you share some code, your project (if not confidential) to reproduce the trace?
I am also getting the same issue. Did you manage to find the solution?
@ahsanwtc Here's my server.js file, actually I'm using initAccounts not directly from the Meteor library but it should work in both cases. Maybe the version on Atmosphere is not the later version, I'll try it.
import {makeExecutableSchema} from 'graphql-tools'
import {loadSchema, getSchema} from 'graphql-loader'
import {initAccounts} from '/imports/lib/accounts-gql/server'
import typeDefs from './schema'
import resolvers from './resolvers'
import {createApolloServer} from 'meteor/orionsoft:apollo'
import cors from 'cors'
const options = {}
// Load all accounts related resolvers and type definitions into graphql-loader
initAccounts(options)
// Load all your resolvers and type definitions into graphql-loader
loadSchema({typeDefs, resolvers})
// Gets all the resolvers and type definitions loaded in graphql-loader
const schema = getSchema()
const executableSchema = makeExecutableSchema(schema)
createApolloServer({
schema: executableSchema
}, {
configServer (graphQLServer) {
graphQLServer.use(cors())
}
})
@dbrrt thanks for the reply. Can you give the the full path to the initAccounts? I am not able to find the lib folder. It's not able to find the path '/imports/lib/accounts-gql/server'
I "repacked" the libraries (client and server), under the lib path, so that's just my project. But I think that if you can't use initAccounts, that's because of an export or something like that.
thank you for your feed back.
I already share my code... all is here (juste a test to integrate apollo in an other app)
In fact there is dependencies issue... I will investigate but i'm pretty sure it's not the problem. If you can (of course), I'm very curious about your test result concerning the meteor initAccount method.
Thank a lot ;)
@rwaness Here's an extract of my packages.json, if that can help:
"dependencies": {
"apollo-client": "^0.5.0",
"babel-runtime": "^6.20.0",
"bcrypt": "^0.8.7",
"body-parser": "^1.16.0",
"classnames": "^2.2.5",
"cors": "^2.8.1",
"express": "^4.14.0",
"graphql": "^0.7.0",
"graphql-loader": "^1.0.1",
"graphql-server-express": "^0.4.3",
"graphql-tools": "^0.8.0",
"graphql-typings": "0.0.1-beta-2",
"invariant": "^2.2.1",
"meteor-node-stubs": "~0.2.0",
"moment": "^2.17.1",
"node-sass": "^3.13.1",
"normalize.css": "^5.0.0",
"react": "^15.3.1",
"react-addons-css-transition-group": "~15.4.0",
"react-addons-pure-render-mixin": "^15.3.1",
"react-apollo": "^0.5.16",
"react-dom": "^15.3.1",
"react-komposer": "^1.13.1",
"react-mounter": "^1.2.0",
"react-redux": "^5.0.2",
"react-router": "^3.0.2",
"react-slick": "^0.14.6",
"redux": "^3.6.0",
"semantic-ui-css": "^2.2.4",
"semantic-ui-react": "^0.64.3"
},
"devDependencies": {
"babel-plugin-module-resolver": "^2.4.0",
"babel-plugin-transform-class-properties": "^6.19.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"semantic-ui": "^2.2.7",
"standard": "^8.5.0"
}
and I didn't have time for now to reproduce your issue with initAccount (directly using the Meteor lib), I'll try ASAP
@rwaness have you solved the problem?
I think that's because the package version installed in your meteor app.
You need to specify the version of this package. If not, 1.0.1 version is installed instead.
Try this:
meteor add nicolaslopezj:apollo-accounts@3.0.1
All good with initAccount now. Thanks to you.
Unfortunatly, I found a second issue.
I follow this tutorial : https://blog.orionsoft.io/using-meteor-accounts-with-apollo-and-react-df3c89b46b17 and when I want to test the application, the server crash and say :
TypeError: Auth is not a function
at meteorInstall.server.schema.Mutation.index.js (server/schema/Mutation/index.js:5:4)
at fileEvaluate (packages\modules-runtime.js:197:9)
at require (packages\modules-runtime.js:120:16)
at C:\Users\erwan\Documents\Travaux\meteor\loocc\tests\api-server\.meteor\local\build\programs\server\app\app.js:220:1
at C:\Users\erwan\Documents\Travaux\meteor\loocc\tests\api-server\.meteor\local\build\programs\server\boot.js:303:34
at Array.forEach (native)
at Function._.each._.forEach (C:\Users\erwan\AppData\Local\.meteor\packages\meteor-tool\1.4.3_2\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\underscore\underscore.js:79:11)
at C:\Users\erwan\Documents\Travaux\meteor\loocc\tests\api-server\.meteor\local\build\programs\server\boot.js:128:5
at C:\Users\erwan\Documents\Travaux\meteor\loocc\tests\api-server\.meteor\local\build\programs\server\boot.js:352:5
at Function.run (C:\Users\erwan\Documents\Travaux\meteor\loocc\tests\api-server\.meteor\local\build\programs\server\profile.js:510:12)
The file server/schema/Mutation/index.js
looks like :
import {SchemaMutations as Auth} from 'meteor/nicolaslopezj:apollo-accounts'
export default `
type Mutation {
${Auth()}
}
`
Is it again a version issue ? How can we know the good version to use ?
Good job guys. Continue ;)
@rwaness Yeah. I think that api version is old.
It has changed.
You better see this install guide.
Or, mine is like below:
import { createApolloServer } from 'meteor/apollo';
import { initAccounts } from 'meteor/nicolaslopezj:apollo-accounts';
import { loadSchema, getSchema } from 'graphql-loader';
import { makeExecutableSchema } from 'graphql-tools';
import cors from 'cors';
import { typeDefs } from './schema';
import { resolvers } from './resolvers';
initAccounts({});
loadSchema({ typeDefs, resolvers });
const schema = makeExecutableSchema(getSchema());
export default () => {
createApolloServer({ schema }, {
configServer(graphQLServer) {
graphQLServer.use(cors());
},
});
};
Yes, it works with the boilerplate : https://github.com/orionsoft/server-boilerplate
Thanks ;)
Hello,
I'm trying to use meteor-apollo-accounts, with the tutorial http://dev.apollodata.com/core/meteor.html and your README.md.
So now I have :
when I launch the application, my server crash :
I really don't understand. Is the tutorial up-to-date ?
thanks in advance, and good job 👍 I really need it ^^