部署到Netlify后Strapi给出404错误

时间:2019-11-14 19:21:08

标签: gatsby netlify strapi

我使用Gatsby和Strapi(开源cms)制作了一个小项目。 当我在本地运行项目时,我可以完美地从Strapi获得所有内容类型。 但是,当我想将项目部署到netlify时,部署失败,并且控制台中出现404错误。

info Starting to fetch data from Strapi - https://agitated-euclid-2d5577.netlify.com/blogposts
error "gatsby-source-strapi" threw an error while running the sourceNodes lifecycle:
Request failed with status code 404

在我的gatsby-config.js中,我使用gatsby-source-strapi

{
  resolve: `gatsby-source-strapi`,
  options: {
    apiURL: process.env.DEPLOY_URL
      ? "https://agitated-euclid-2d5577.netlify.com"
      : "http://localhost:1337",
    contentTypes: [`blogposts`],
    queryLimit: 1000,
  },
},

在Strapi仪表板中,我已将blogpost的权限设置为find。我不认为这是由于允许而出现的错误。

1 个答案:

答案 0 :(得分:0)

您的部署URL不正确。它应该是您生产中Strapi应用程序的URL。

您在此处设置生产中的前端APP的URL。

如果您跟随Tuto,我们将设置应用程序的HEROKU URL。这是Strapi应用程序的生产URL。不是您的前端应用程序的URL。

相关问题