Coder Social home page Coder Social logo

Comments (11)

acomito avatar acomito commented on June 19, 2024

Seems like I'll find the answer here:

https://github.com/janikvonrotz/meteor-apollo-accounts-example/blob/master/server/schema.js

Any other hints would be appreciated

from meteor-apollo-accounts.

nicolaslopezj avatar nicolaslopezj commented on June 19, 2024

That is an old example, now just create the User schema

from meteor-apollo-accounts.

acomito avatar acomito commented on June 19, 2024

@nicolaslopezj I do have a type User schema but meteor-apollo-accounts doesn't seem to be aware of it. Where do the two connect? The User schema is registered (I can do my own mutations on it) but createAccount() is not aware of it, and so it throws an errror with everything other than the default schema (profile: { Name: String } }

import { createApolloServer } from 'meteor/apollo';
import { makeExecutableSchema } from 'graphql-tools';
import { typeDefs, resolvers } from '/imports/api/schema';
import {loadSchema, getSchema} from 'graphql-loader'
import {initAccounts} from 'meteor/nicolaslopezj:apollo-accounts'
import cors from 'cors';

//set options
// Load all accounts related resolvers and type definitions into graphql-loader
initAccounts({});

// 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 = makeExecutableSchema(getSchema());

//create server
createApolloServer({ schema }, {
  configServer: graphQLServer => graphQLServer.use(cors()),
});

from meteor-apollo-accounts.

nicolaslopezj avatar nicolaslopezj commented on June 19, 2024

Can you show me the error?

from meteor-apollo-accounts.

acomito avatar acomito commented on June 19, 2024

Variable "$profile" got invalid value {"cell":"42341","name":{"first":"fsadf","last":"fsfda"}}. In field "cell": Unknown field.

In graphiql my createUser mutation shows this:

username: String
email: String
password: HashedPassword
plainPassword: String
profile: CreateUserProfileInput

So somewhere along the line my schema is not getting into the packages mutations. I'm guessing that I'm missing something in my imports/startup/server/grapQL-config.js or how I load my schemas in imports/api/schema.js?

example here: https://github.com/acomito/spacebug-graphql.git

from meteor-apollo-accounts.

nicolaslopezj avatar nicolaslopezj commented on June 19, 2024

Are you defining the input CreateUserProfileInput?

from meteor-apollo-accounts.

acomito avatar acomito commented on June 19, 2024

I have no explicitly set it. Where do you do that? Here?

//set options
const options = {
	CreateUserProfileInput: `
	    name: Name!
	  `
};

// Load all accounts related resolvers and type definitions into graphql-loader
initAccounts(options);

from meteor-apollo-accounts.

nicolaslopezj avatar nicolaslopezj commented on June 19, 2024

Define it in your schema

input CreateUserProfileInput {
  name: String!
  otherField: String
}

from meteor-apollo-accounts.

acomito avatar acomito commented on June 19, 2024

ahh okay

from meteor-apollo-accounts.

acomito avatar acomito commented on June 19, 2024

That works now. What if I want to nest data I'm inserting?

type Name {
  first: String
  last: String
}

input CreateUserProfileInput {
  name: Name
  cell: String
}

from meteor-apollo-accounts.

nicolaslopezj avatar nicolaslopezj commented on June 19, 2024

Just define that type in other file

from meteor-apollo-accounts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.