首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Postgraphile -“必须提供查询根”错误消息

Postgraphile -“必须提供查询根”错误消息
EN

Stack Overflow用户
提问于 2018-07-07 13:46:57
回答 1查看 1.2K关注 0票数 0

我们已经有了一个包含数据的postgresql数据库,并且我们正在试验postgraphile作为graphql API。我们遇到了一个让我们摸不着头脑的错误。服务器运行得很好,但我们得到了以下信息:

代码语言:javascript
复制
postgraphile -c postgres://username:password@localhost:5432/my_db                                                                

PostGraphile server listening on port 5000                                                                                                                 

  ‣ Connected to Postgres instance postgres://localhost:5432/my_db                                                                                          
  ‣ Introspected Postgres schema(s) public                                                                                                                      
  ‣ GraphQL endpoint served at http://localhost:5000/graphql                                                                                                    
  ‣ GraphiQL endpoint served at http://localhost:5000/graphiql                                                                                                  

* * *                                                                                                                                                           

An error occurred, it might be okay but it doesn't look like the error we were expecting... run with envvar 'DEBUG="graphile-build:warn"' to view the error     
An error occurred, it might be okay but it doesn't look like the error we were expecting... run with envvar 'DEBUG="graphile-build:warn"' to view the error     

Error: Query root type must be provided.                                                                                                                        
    at assertValidSchema (C:\Users\user\AppData\Roaming\npm\node_modules\postgraphile\node_modules\graphql\type\validate.js:78:11)                      
    at Object.validate (C:\Users\user\AppData\Roaming\npm\node_modules\postgraphile\node_modules\graphql\validation\validate.js:61:35)                  
    at parseQuery (C:\Users\user\AppData\Roaming\npm\node_modules\postgraphile\build\postgraphile\http\createPostGraphileHttpRequestHandler.js:208:48)  
    at Promise.all.paramsList.map (C:\Users\user\AppData\Roaming\npm\node_modules\postgraphile\build\postgraphile\http\createPostGraphileHttpRequestHandler.js:469:63)                                                                                                                                                  
    at Array.map (<anonymous>)                                                                                                                                  
    at requestHandler (C:\Users\user\AppData\Roaming\npm\node_modules\postgraphile\build\postgraphile\http\createPostGraphileHttpRequestHandler.js:435:52)                                                                                                                                   
    at <anonymous>                                                                                                                                              
    at process._tickCallback (internal/process/next_tick.js:188:7) 

当我们导航到localhost:500/graphiql时,我们在文档资源管理器中看到一个"no schema available“。

查询根是public模式吗?或者我们错过了什么?

EN

回答 1

Stack Overflow用户

发布于 2018-09-11 01:48:02

较新版本的PostGraphile有更有用的错误消息,通常包括建议的解决方案。类似上述的“发生错误”错误现在还包含有助于诊断的潜在错误的预览。

这里有关于如何设置DEBUG环境变量的说明:https://www.graphile.org/postgraphile/debugging/#debug-envvars

下面是你在Linux、macOS或Windows中如何做到这一点:

代码语言:javascript
复制
# Bash (Linux, macOS, etc)
export DEBUG="graphile-build:warn" postgraphile -c postgres://username:password@localhost:5432/my_db

# Windows Console
set DEBUG=graphile-build:warn & postgraphile -c postgres://username:password@localhost:5432/my_db

# Windows PowerShell
$env:DEBUG = "graphile-build:warn"; postgraphile -c postgres://username:password@localhost:5432/my_db
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51220312

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档