Giter Club home page Giter Club logo

node-graphql-server's People

Contributors

dandv avatar devanb avatar juicycleff avatar kbrandwijk avatar lunchboxer avatar manjula-dube avatar marktani avatar maticzav avatar nikolasburk avatar orta avatar rarkins avatar renovate-bot avatar renovate[bot] avatar schickling avatar sorenbs avatar tatchi avatar timsuchanek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-graphql-server's Issues

Cannot read property 'getDeployEndpoint' of undefined

UBUNTU 16.04 with graphcool@beta && graphql-cli@beta - tested with (git clone && graphql create) :

  • node-graphql-server/advanced
  • typescript-graphql-server/basic
  • typescript-graphql-server/advanced

Error when graphql deploy to local cluster [yarn start / npm start is working] :

graphcool deploy
config CWD /home/manu/Project/node-graphql-server/advanced +0ms
config HOME /home/manu +1ms
config definitionDir /home/manu/Project/node-graphql-server/advanced +1ms
config definitionPath /home/manu/Project/node-graphql-server/advanced/graphcool.yml +0ms
cli command id deploy +0ms
cli:plugincache Got plugin from cache +0ms
cli:plugincache /home/manu/.cache/graphcool/plugins.json +0ms
cli:plugincache Got plugin from cache +1ms
cli:plugincache /home/manu/.cache/graphcool/plugins.json +0ms
plugins findCommand graphcool-cli-core +0ms
plugin requiring command +0ms
cli-engine:plugins:manager requiring /home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-core +0ms
cli-engine:plugins:manager required +237ms
plugin required command +239ms
deploy run +0ms
?

Please choose the cluster you want to deploy "graphql-boilerplate@dev" to

TypeError: Cannot read property 'getDeployEndpoint' of undefined
at Client.get [as client] (/home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/src/Client/Client.ts:132:29)
at Client. (/home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/src/Client/Client.ts:383:40)
at step (/home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/dist/Client/Client.js:32:23)
at Object.next (/home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/dist/Client/Client.js:13:53)
at /home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/dist/Client/Client.js:7:71
at __awaiter (/home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/dist/Client/Client.js:3:12)
at Client.listProjects (/home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/dist/Client/Client.js:293:16)
at Deploy. (/home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-core/src/commands/deploy/index.ts:216:40)
at step (/home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-core/dist/commands/deploy/index.js:42:23)
at Object.next (/home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-core/dist/commands/deploy/index.js:23:53)
at /home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-core/dist/commands/deploy/index.js:17:71
at __awaiter (/home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-core/dist/commands/deploy/index.js:13:12)
at Deploy.projectExists (/home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-core/dist/commands/deploy/index.js:208:16)
at Deploy. (/home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-core/src/commands/deploy/index.ts:160:21)
at step (/home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-core/dist/commands/deploy/index.js:42:23)
at Object.next (/home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-core/dist/commands/deploy/index.js:23:53)
at fulfilled (/home/manu/.nvm/versions/node/v7.10.1/lib/node_modules/graphcool/node_modules/graphcool-cli-core/dist/commands/deploy/index.js:14:58)
Exiting with code: 1

I also get this when I use graphql create :

├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── UNMET PEER DEPENDENCY graphql@^0.10.0 || ^0.11.0
│ │ │ ├─┬ [email protected]
│ │ │ │ └── UNMET PEER DEPENDENCY graphql@^0.10.0 || ^0.11.0
│ │ │ ├── UNMET PEER DEPENDENCY graphql@^0.10.0 || ^0.11.0

[advanced example] feed.author subquery fails when using variables

Query

query ($where: UserWhereInput) {
  feed {
    id
    title
    author(where: $where) {
      id
    }
  }
}

Variables

{
  "where": {
    "email": "[email protected]"
  }
}

Response

{
  "data": null,
  "errors": [
    {
      "message": "Variable \"$where\" got invalid value {\"isPublished\":true}; Field \"isPublished\" is not defined by type UserWhereInput.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "feed"
      ]
    }
  ]
}

It seems that the variable $where gets the wrong value applied.

Missing Post in schema.graphql - advanced

I get the following error when running yarn start after a fresh setup of the advanced boilerplate:

ALT8AG8WL:server rlanier$ yarn start
yarn run v1.3.2
warning package.json: No license field
$ nodemon -e js,graphql -x node -r dotenv/config src/index.js
[nodemon] 1.14.11
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node -r dotenv/config src/index.js`
/Users/rlanier/Projects/Reruled/server/node_modules/graphql-yoga/node_modules/graphql-tools/dist/schemaGenerator.js:294
                throw new SchemaError(typeName + "." + fieldName + " defined in resolvers, but not in schema");
                ^

Error: Query.post defined in resolvers, but not in schema
[nodemon] app crashed - waiting for file changes before starting...

It appears there is no post in the Query type defined in schema.graphql. I can submit a PR if need be.

Make start message awesome

Currently the start message looks like this:

image

I think we can make it a lot more awesome and welcoming.

Add subscriptions to advanced

example:

import { Context } from '../utils'

export const Subscription = {
  city: {
    subscribe: async (parent, args, ctx: Context, info) => {
      return ctx.db.subscription.city({}, info)
    },
  },
}

Cannot connect to DB

Getting error from graphql playground:

{
"requestId": "api:api:cjbmqvwun000s0122f9u0yri4",
"error": "Whoops. Looks like an internal server error. Please contact us from the Console (https://console.graph.cool) or via email ([email protected]) and include your Request ID: api:api:cjbmqvwun000s0122f9u0yri4"
}

This is happening locally.

Improve the 'server is running on...' line

It is hardcoded, so it shows the wrong output on now deploy:

> Server is running on http://localhost:4000
> Deployment complete!
> Assigning alias test22 to deployment...
> Success! test22.now.sh now points to test22-ovjwthlooz.now.sh! [3s]

Project Requirements

This project is meant as a go-to resource for modern, scalable GraphQL server implementations.

Requirements

  • Use case that contains all following requirements
  • Control delegated schema args (e.g. filter)
  • Authorization
    • Elegant query permission system
    • Middleware system
  • Logging
  • Dataloader pattern
  • Scalable code structure
  • Compensate breaking changes caused by the database model
  • File handling
  • Subscriptions
  • Schema stitching
  • Easy deployment
  • Fast development/feedback flow
    • Compile check based on stitched schemas
    • Codegen
  • integration with Apollo Engine

Collection of common scenarios

Scenarios

The following is a collection of commons scenarios, with the goal of providing step-by-step explanations of how to go about them.

All scenarios are based on typescript-basic.

Adding fields to an existing type

Example & Instructions

Example

Adding a new address field to the user type in the database, with the purpose of exposing it in the application API as well.

Instructions

1. Adding the field to the data model

in database/datamodel.graphql:

type User {
  id: ID! @unique
  email: String! @unique
  password: String!
  name: String!
  posts: [Post!]! @relation(name: "UserPosts")
+ address: String
}

2. Deploying the updated data model

graphcool deploy

This will

  • deploy the new database structure to the local service
  • download the new GraphQL schema for the database to database/schema.graphql

3. Adding the field to the application schema

in src/schema.graphql:

type User {
  id: ID!
  email: String!
  name: String!
  posts: [Post!]!
+ address: String
}

Adding a new resolver to the GraphQL server

Example & Instructions

Example

Suppose we want to add a custom resolver to delete a post.

Instructions

Add a new delete field to the Mutation type in src/schema.graphql

type Mutation {
  createDraft(title: String!, text: String): Post
  publish(id: ID!): Post
+ delete(id: ID!): Post
}

Add a delete resolver to Mutation part of src/index.js

delete(parent, { id }, ctx, info) {
  return ctx.db.mutation.deletePost(
  {
    where: { id }
  },
    info
  );
}

Run yarn start.

Then we can run the following mutation to delete a post:

mutation {
  delete(id: "post-id") {
    id
  }
}

Further resolver-centric scenarios

Other scenarios

Playground have bad url of Database

My local environment is running on port 6001 instead of 6000. I defined GRAPHCOOL_ENDPOINT with different port in .env, but when i open playground on port 4000 database is running on port 6000 instead of 6001, what i defined in .env

Now integration costly

Installing the boilerplate works great until it gets to the now integration. I waited about five seconds for the rest of the package to download and install and the now cli is downloading... still, as I type. I don't know why it takes so long, but I also don't know why it's baked in to begin with. Is there anything special about graphcool that makes using now especially difficult? If a user wants to use now can't they just download the cli and use it? What is the advantage of integration? I don't use now so all I see is the cost, since it's still downloading.

README: Add a custom resolver

Spoke to @marktani about adding a custom resolver to the service and we need some documentation for that in README.

So, following steps are required:-

Suppose we want to add a resolver for deleting a post, we will first add it to src/schema.graphql file

type Mutation {
  createDraft(title: String!, text: String): Post
  publish(id: ID!): Post
  delete(id: ID!): Post
}

Then we can add a resolver function to Mutation part of src/index.js

    delete(parent, { id }, ctx, info) {
      return ctx.db.mutation.deletePost(
        {
          where: { id }
        },
        info
      );
    }

Notice that the resolver uses deletePost which is a graphcool-binding

Lastly, run yarn start

I will make a PR to document this in README shortly.

Thanks!

A Tutorial for the beta version

Would love to have a single page description about how graphcool deploy works in the projects created by the cli. How do I deploy it locally or on a private server.

Schema could not be fetched

Started the project as here:
https://github.com/graphql-boilerplates/node-graphql-server/tree/master/basic#getting-started

yarn start

Server is running on http://localhost:4000


app/ default
endpoint: http://localhost:4000

Unexpected token H in JSON at position 0

{ "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJh …"}


database/ dev
endpoint: https://dev.database-beta.graph.cool/api/my-app/dev

Schema could not be fetched. Please check if the endpoint 'https://dev.database-beta.graph.cool/api/my-app/dev' is a valid GraphQL Endpoint.

I get a token through these steps:

https://github.com/graphql-boilerplates/node-graphql-server/tree/master/basic#im-getting-a-schema-could-not-be-fetched-error-after-deploying-what-gives

But after refresh

Schema could not be fetched. Please check if the endpoint 'https://dev.database-beta.graph.cool/api/my-app/dev' is a valid GraphQL Endpoint.



Where am I wrong?

writePost error

When trying to make a post an error is thrown.

mutation Post {
	writePost(title: "test", text: "bar") {
    id
    isPublished
  }
}
{
  "data": null,
  "errors": [
    {
      "message": "Variable \"$_data\" got invalid value {\"title\":\"test\",\"text\":\"bar\",\"authorId\":\"cjb6z5jm400320135nx0eixat\",\"isPublished\":true}.\nIn field \"authorId\": Unknown field.",
      "locations": [
        {
          "line": 23,
          "column": 2
        }
      ],
      "path": [
        "writePost"
      ]
    }
  ]
}

Handle environments with other ports than 60000

Some environments already use port 60000 which means graphcool-dev runs on 60001, or potentially another port. graphcool-framework runs on 60000, too. So it's quite likely that you end up with port 60001 for graphcool.

All boilerplates hardcode the port 60000 which leads to problems like this.

Is there a way to detect the graphcool port dynamically and use this value instead of a hardcoded port?

no such file or directory, open 'graphcool.yml'

graphql create test # choose node-basic

? Choose GraphQL boilerplate project: node-basic              Basic GraphQL server (incl. database)
[graphql create] Downloading boilerplate from https://github.com/graphql-boilerplates/node-graphql-server/archive/master.zip...

[graphql create] Installing node dependencies for /Users/marktani/projects/graphcool/graphcool/examples/subscriptions/package.json...
yarn install v0.27.5
warning package.json: No license field
warning graphql-boilerplate: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "[email protected]" has unmet peer dependency "aws-lambda@^0.1.2".
[4/4] Building fresh packages...
Done in 7.22s.
[graphql create] Running boilerplate install script...
✖
ENOENT: no such file or directory, open 'graphcool.yml'

I assume this is caused by the fact that graphcool.yml is not in test but in test/database.

graphql -v
2.10.0

Couldn't find graphcool.yml file

graphql create test # choose node-basic

results in this error

Running $ graphcool deploy...
 ▸    Couldn't find `graphcool.yml` file. Are you in the right directory?
gc version
graphcool/1.0.0-alpha3.3.5 (darwin-x64) node-v8.3.0

graphql -v
2.10.0

Create post mutation creates duplicate post

mutation createPost { writePost(title: "Why GraphQL will change your life!", text: "Rest in pieces") { id } }

This creates duplicate post every time, effectively creating two posts. The writePost resolver is called only once though, which makes me think there's some issue with ctx.db.mutation.createPost.

Also can anyone explain where does this db.mutation.createPost come from?

Running boilerplate install script... ✖ Unexpected token )

UBUNTU 16.04 with graphcool@beta [1.0.0-beta2.1.1] && graphql-cli@beta [2.1.0-beta18]

$ graphql create %appName% --boilerplate node-advanced

(...)
[graphql create] Running boilerplate install script...

Unexpected token )

Other things :

  • Node : 7.10.1
  • Docker : 17.09.1-ce
  • Docker-compose : 1.8.0

Running $ graphql create %appName% :

├─┬ [email protected]
│ ├─┬ @types/[email protected]
│ │ └── @types/[email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├─┬ UNMET PEER DEPENDENCY [email protected]

├─┬ [email protected]
│ ├── @types/[email protected]
│ ├─┬ @types/[email protected]
│ │ ├── @types/[email protected]
│ │ ├── @types/[email protected]
│ │ └─┬ @types/[email protected]
│ │ └── @types/[email protected]
│ ├── @types/[email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── UNMET PEER DEPENDENCY graphql@^0.10.0 || ^0.11.0
│ │ │ ├─┬ [email protected]
│ │ │ │ └── UNMET PEER DEPENDENCY graphql@^0.10.0 || ^0.11.0
│ │ │ ├── UNMET PEER DEPENDENCY graphql@^0.10.0 || ^0.11.0

Cannot read property 'getDeployEndpoint'

I followed the instructions in the advanced example and I get this error:

config CWD /Users/luisurrutiaf/Projects/Personal/node-graphql-server/advanced +0ms
config HOME /Users/luisurrutiaf +2ms
config definitionDir /Users/luisurrutiaf/Projects/Personal/node-graphql-server/advanced +1ms
config definitionPath /Users/luisurrutiaf/Projects/Personal/node-graphql-server/advanced/graphcool.yml +0ms
cli command id deploy +0ms
cli:plugincache Got plugin from cache +0ms
cli:plugincache /Users/luisurrutiaf/Library/Caches/graphcool/plugins.json +0ms
cli:plugincache Got plugin from cache +2ms
cli:plugincache /Users/luisurrutiaf/Library/Caches/graphcool/plugins.json +0ms
plugins findCommand graphcool-cli-core +0ms
plugin requiring command +0ms
cli-engine:plugins:manager requiring /usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-core +0ms
cli-engine:plugins:manager required +672ms
plugin required command +676ms
deploy run +0ms

? Please choose the cluster you want to deploy "dev" to
TypeError: Cannot read property 'getDeployEndpoint' of undefined
at Client.get [as client] (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/src/Client/Client.ts:132:29)
at Client. (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/src/Client/Client.ts:383:40)
at step (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/dist/Client/Client.js:32:23)
at Object.next (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/dist/Client/Client.js:13:53)
at /usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/dist/Client/Client.js:7:71
at Promise ()
at __awaiter (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/dist/Client/Client.js:3:12)
at Client.listProjects (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/dist/Client/Client.js:293:16)
at Deploy. (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-core/src/commands/deploy/index.ts:216:40)
at step (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-core/dist/commands/deploy/index.js:42:23)
at Object.next (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-core/dist/commands/deploy/index.js:23:53)
at /usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-core/dist/commands/deploy/index.js:17:71
at Promise ()
at __awaiter (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-core/dist/commands/deploy/index.js:13:12)
at Deploy.projectExists (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-core/dist/commands/deploy/index.js:208:16)
at Deploy. (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-core/src/commands/deploy/index.ts:160:21)
Exiting with code: 1

Separate server and schema generation

To increase reusability, I have done this in all my Gateway examples:

  • split server.ts into server.ts and schema.ts
  • schema.ts should export const schema

This also makes it easier to copy-paste the contents of schema.ts into an Apollo Launchpad for easy development and testing.

Following Install Instructions Generated Errors at "create" step

While following instructions I saw the following error message when trying to create a project:

graphql create graphql-example-project

? Choose GraphQL server template: Minimal (Node.js, DB)
[graphql create] Downloading template from https://github.com/graphcool/graphql-template-node/archive/master.zip...
[graphql create] Installing node dependencies...

(node:2155) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'message' of null
(node:2155) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

graphql version 2.1.0-beta4
node version 9.2.1

GraphQL config: database endpoint is wrong

Current behaviour:

current graphql config yaml is:

projects:
  app:
    ...
  database:
    schemaPath: "database/schema.generated.graphql"
    extensions:
      graphcool: graphcool.yml

if I'm sending request directly to database I'm getting next error:

{
  "requestId": "api:api:cjbmbmvz11rsr0168vzjqmmf9",
  "error": "Whoops. Looks like an internal server error. Please contact us from the Console (https://console.graph.cool) or via email ([email protected]) and include your Request ID: api:api:cjbmbmvz11rsr0168vzjqmmf9"
}

It seems that service endpoint is wrong:

Schema could not be fetched.
Please check if the endpoint 'https://dev.database-beta.graph.cool/api/rcoach-server/dev' is a valid GraphQL Endpoint.

after changing graphqlconfig.yaml to

projects:
  app:
    ...
  database:
    schemaPath: "database/schema.generated.graphql"
    extensions:
      endpoints:
        default: "https://database-beta.graph.cool/rcoach-server/dev"

it finally works

Expected:

instead of https://dev.database-beta.graph.cool/api/rcoach-server/dev is should be https://database-beta.graph.cool/rcoach-server/dev

Either boilerplate code is wrong or graphql-config library has a bug.

Missing peer dependency warnings

All boilerplates have missing dependencies 'graphql' and 'graphql-tools':

warning "graphcool-binding > [email protected]" has unmet peer dependency "graphql-tools@^2.4.0 || ^2.5.0 || ^2.6.0 || ^2.7.0".
warning "graphql-yoga > [email protected]" has unmet peer dependency "graphql@^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0".
warning "graphql-yoga > [email protected]" has unmet peer dependency "graphql@^0.11.0".
warning "graphql-yoga > [email protected]" has unmet peer dependency "graphql@^0.10.5 || ^0.11.3".
warning "graphql-yoga > [email protected]" has unmet peer dependency "graphql@^0.10.0 || ^0.11.0".
warning "graphql-yoga > apollo-server-express > [email protected]" has unmet peer dependency "graphql@^0.9.0 || ^0.10.0 || ^0.11.0".
warning "graphql-yoga > apollo-server-express > apollo-server-core > [email protected]" has unmet peer dependency "graphql@^0.10.0 || ^0.11.0".
warning "graphql-yoga > apollo-server-express > apollo-server-core > [email protected]" has unmet peer dependency "graphql@^0.10.0 || ^0.11.0".
warning "graphql-yoga > apollo-server-express > apollo-server-core > [email protected]" has unmet peer dependency "graphql@^0.10.0 || ^0.11.0".

Use cross-env

The syntax to set the environment variable in the npm scripts doesn't work on Windows...

Example queries and mutations

server

# first, we'll receive an empty feed
query emptyFeed {
  feed {
    id
  }
}

# let's signup! we'll store the received token in the a new 'Authorization: Bearer <token>' header
mutation signup {
  signup(
    email: "[email protected]"
    password: "default"
    name: "Nilan"
  ) {
    token
    user {
      id
      posts {
        id
      }
    }
  }
}

# let's create our first post! make sure to set the Authorization header correctly
mutation createPost {
  writePost(
    title: "Why GraphQL will change your life!"
    text: "Rest in pieces"
  ) {
    id
  }
}

db

# we'll see the new post, but it's not published yet
query getPosts {
  allPosts {
    id
    isPublished
  }
}

Update boilerplate setup

  • Call gc deploy from install script
  • Remove default cluster from 'graphcool.yml'
  • Ping nearest cluster (for fullstack only) -> on hold until graphcool cli offers this again
  • Write endpoint to .env after deployment

^^ In all boilerplates

Unclear instructions

I have troubles with graphql-boilerplate:

  1. graphql create my-app
    select ‘advanced typescript’

  2. cd my-app

  3. graphcool deploy ->
    select ‘local’ and got ERROR: Cannot read property 'getDeployEndpoint' of undefined

deploying to shared-cluster works

Expected behaviour:
It should work or clear error should be printed

  1. yarn deploy and got ERROR: --dotenv flag is set but .env.prod file is missing

Expected behaviour: there should be an instruciton about .env.prod file

Unexpected token H in JSON at position 0

I encountered this error when doing any query to the GraphQL server:

Unexpected token H in JSON at position 0

Killing my local docker containers (including all local data) solved this issue for me:

docker kill (docker ps -aq)
docker rm (docker ps -a -f status=exited -q)
docker volume rm (docker volume ls -q)
graphcool local up # pull latest docker image for graphcool
graphcool deploy

Playground not showing up the left "app/database" pane.

I was following the Node.js Graphcool Quickstart tutorial and, after running graphcool playground, I couldn't see the left pane with the two GraphQL APIs (app and database) shown in step 5.

Same happens with playground standalone version.

graphcool --version
graphcool/1.0.0-beta4.1.1 (windows-x64) node-v8.9.4
[email protected]

package.json

{
  "name": "my-app",
  "scripts": {
    "start": "cross-env NODE_ENV=dev node src/index.js",
    "playground": "graphcool playground"
  },
  "dependencies": {
    "graphcool-binding": "1.3.5",
    "graphql-yoga": "^1.1.5"
  },
  "devDependencies": {
    "cross-env": "^5.1.3",
    "graphcool": "1.0.0-beta4.1.1"
  }
}

I've just modified the start script adding cross-env to make it compatible with Windows.

Errors while validating graphcool.yml

When I ran graphcool deploy I got these errors:

[ERROR] in /Users/erichodges/Documents/graphcool/graphql-boilerplate-1/graphcool.yml: Errors while validating graphcool.yml:

Error:   data should NOT have additional properties
   at Output.error (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/src/Output/index.ts:164:15)
   at Object.<anonymous> (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/src/ProjectDefinition/yaml.ts:38:9)
   at step (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/dist/ProjectDefinition/yaml.js:32:23)
   at Object.next (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/dist/ProjectDefinition/yaml.js:13:53)
   at fulfilled (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-engine/dist/ProjectDefinition/yaml.js:4:58)
   at <anonymous>
Exiting with code: 1

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.