Giter Site home page Giter Site logo

Comments (9)

StephenGilboy avatar StephenGilboy commented on June 23, 2024 1

I know this is quite a few months old but for someone else who might run into this issue I was able to solve it by adding a .env file and setting the WORDPRESS_URL= there.

from gridsome-starter-wordpress.

CSchloegel avatar CSchloegel commented on June 23, 2024

I'm having this same issue

from gridsome-starter-wordpress.

Alligatore3 avatar Alligatore3 commented on June 23, 2024

Hi @simduchaine
Can you please provide your gridsome.config ?

I had the same error but I was giving the wrong baseUrl for my local Wordpress environment.

from gridsome-starter-wordpress.

simduchaine avatar simduchaine commented on June 23, 2024

@Alligatore3 Here's my gridsome.config.js:

module.exports = {
  siteName: "Gridsome",
  siteDescription: "A WordPress starter for Gridsome",
  plugins: [
    {
      use: "@gridsome/source-wordpress",
      options: {
        baseUrl: process.env.WORDPRESS_URL, // required
        apiBase: "wp-json",
        typeName: "WordPress",
        perPage: 10,
        concurrent: 0,
        routes: {
          post: "/:year/:month/:day/:slug",
          post_tag: "/tag/:slug"
        }
      }
    }
  ]
};

And here's my ENV variable:
[template.environment] WORDPRESS_URL = "https://voyage.simonduchaine.com"

Note that I'm trying to fetch a live prod website not a local wordpress env.

from gridsome-starter-wordpress.

Alligatore3 avatar Alligatore3 commented on June 23, 2024

@simduchaine
I'm not an expert with node env but I'm pretty sure that if you put your_path directly inside gridsome.config.js it works.

I tried with my remote env, I put my URL like this:
options: { baseUrl: 'https://voyage.simonduchaine.com', // required

Actually I got another error 😅 but at least not this one.

from gridsome-starter-wordpress.

simduchaine avatar simduchaine commented on June 23, 2024

@Alligatore3 tried your suggestion, didn't get the ERCONNREFUSED but still, the issue is almost the same as now it's Graphql throwing a error 500 (try the gridsome explore command and you'll see).

from gridsome-starter-wordpress.

dosstx avatar dosstx commented on June 23, 2024

I know this is quite a few months old but for someone else who might run into this issue I was able to solve it by adding a .env file and setting the WORDPRESS_URL= there.

What is the exact file name for the .env file you added? Is it just .env.json in root?

from gridsome-starter-wordpress.

StephenGilboy avatar StephenGilboy commented on June 23, 2024

I know this is quite a few months old but for someone else who might run into this issue I was able to solve it by adding a .env file and setting the WORDPRESS_URL= there.

What is the exact file name for the .env file you added? Is it just .env.json in root?

The exact file name is .env it is called a dotfile. And yes you just put it at the root dir.

from gridsome-starter-wordpress.

djmtype avatar djmtype commented on June 23, 2024

Using this theme as is, gridsome build fails when building the site on Netlify.

I thought, inside the netlify.toml file, the WORDPRESS_URL value should be set to the exact one specified in my .env file. However, that's not the case. (I'd appreciate some explanation why this fails. BTW, I also tried adding the exact json endpoint, too. Example: https://portal.mysite.com/wp-json)

I actually, had to remove the entire [template.environment] declaration from the netlify.toml file first.

Remove:

[template.environment]
  WORDPRESS_URL = "https://portal.mysite.com"

Then in my Netlify account, goto Settings > Build & Deploy > Environment Variables, add the same credentials from my .env file.

For example:

Key = WORDPRESS_URL
Value = https://portal.mysite.com

Now it works.

from gridsome-starter-wordpress.

Related Issues (20)

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.