2016-10-13 32 views
2

我收到的開發者控制檯以下消息:?「中繼架構緩​​存不更新

Uncaught Error: GraphQL validation error. Cannot query field XXXX in YYYY.js. Try updating your GraphQL schema if an argument/field/type was recently added

我已經嘗試以更新模式運行故宮開始我在做什麼錯

+0

你能分享查詢和模式嗎?沒有這個很難說。 –

+0

據我所知這是一個更新問題,與實際的模式和查詢無關 – whamsicore

回答

0

您可能需要爲您更新您的客戶端模式的構建功能,包括你的package.json中的腳本來運行這個自動使用nodemon。

這是腳本,我使用。

#!/usr/bin/env babel-node --optional es7.asyncFunctions 

import fs from 'fs' 
import path from 'path' 
import Schema from './schema.js' 
import touch from 'touch' 

import { graphql } from 'graphql' 
import { introspectionQuery, printSchema } from 'graphql/utilities' 

const p = '../../../client/schema-build/schema.json'; 

// Save JSON of full schema introspection for Babel Relay Plugin to use 
(async() => { 
    var result = await (graphql(Schema, introspectionQuery)) 
    if (result.errors) { 
    console.error(
     'ERROR introspecting schema: ', 
     JSON.stringify(result.errors, null, 2) 
    ) 
    } else { 
    fs.writeFileSync(
     path.join(__dirname, p), 
     JSON.stringify(result, null, 2) 
    ) 

    touch('../../../client/index.js', {},() => { 
     process.exit(0) 
    }) 
    } 
})() 

// Save user readable type system shorthand of schema 
fs.writeFileSync(
    path.join(__dirname, p), 
    printSchema(Schema) 
)