drupal - “gatsby-source-graphql”没有链接到 Drupal 8
问题描述
siteMetadata: {
title: `Gatsby Default Starter`,
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
author: `@gatsbyjs`,
},
plugins: [
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
},
},
{
resolve: "gatsby-source-graphql",
options: {
// Arbitrary name for the remote schema Query type
typeName: "DRUPAL",
// Field under which the remote schema will be accessible. You'll use this in your Gatsby query
fieldName: "drupal",
// Url to query from
url: "https://intl-pgs-rsm-growth-platform.pantheonsite.io/graphql",
},
},
],
}
这是我的 gatsby-config.js 文件当我运行 gatsby clean && gatsby develop 或只是 gatsby build 我得到
success createSchemaCustomization - 0.005s
ERROR #11321 PLUGIN
"gatsby-source-graphql" threw an error while running the sourceNodes lifecycle:
Unexpected token < in JSON at position 0
ServerParseError: Unexpected token < in JSON at position 0
- JSON.parse
- index.js:35
[test-gatsby]/[apollo-link-http-common]/lib/index.js:35:25
- next_tick.js:68 process._tickCallback
internal/process/next_tick.js:68:7
not finished source and transform nodes - 0.506s
我的 Drupal 8 站点是安装了 graphql 模块的新站点。盖茨比网站也是全新的。
在工作了一段时间后,我周一开始遇到这个问题。我的 gatsby 没有代码更改,但突然之间我不再能够获取 drupal 数据。
使用“gatsby-source-graphql”插件的例子似乎很少,所以如果有人可以帮忙,请做
解决方案
就我而言,这是 Drupal 中的权限问题。我通过转到管理员 → 人员 → 权限并为匿名用户设置与 GraphQL 相关的所有权限来解决它。
推荐阅读
- python - SQLITE3:更新数据库时出错
- hdf5 - GDAL:库未加载 libhdf5.100.dylib
- apache-camel - 如何使用 apache camel 在 DynamoDb 中将地图作为属性值?
- python - 在我的 base.html 上显示用户图像 ({{ userprofile.image.url }})
- java - 从带有流的枚举中收集值不起作用
- three.js - 如何在 aframe 中使用 web url 加载 obj-model
- r - 如何将绘图导出到 HTML 页面
- python-3.x - Colabs 文件传输不驱动
- css - 将变量设置为具有相同的属性值
- outlook-web-addins - Outlook插件:按下“操作”时调用“任务窗格”的js代码