1

I have a site running Gatsby and Gatsby-Source-Drupal7, it is a plugin that uses Graphql to make an axios get request to https://stagingsupply.htm-mbs.com/restws_resource.json and uses the json data to query. I am able to run it just fine on my computer by going to localhost:8000 and it creates over 200k nodes, but when I try to deploy on any cloud service provider like Gatsby Cloud or Netlify it doesn't fetch any nodes or data at all from the site.

Warning from console

Starting to fetch data from Drupal
warn The gatsby-source-drupal7 plugin has generated no Gatsby nodes. Do you need
 it?

Code

code from gatsby config

module.exports = {
    siteMetadata: {
      title: `new`,
        siteUrl: `https://www.yourdomain.tld`,
    },
    plugins: [
      {
        resolve: `gatsby-source-drupal7`,
        options: {
          baseUrl: `https://stagingsupply.htm-mbs.com/`,
          apiBase: `restws_resource.json`, // optional, defaults to `restws_resource.json`
        },
      },
    ]
}

gatsby-config.js from node_modules/gatsby-source-drupal7

const createNode = actions.createNode; // Default apiBase to `jsonapi`

    apiBase = apiBase || `restws_resource.json`; // Fetch articles.
    // console.time(`fetch Drupal data`)

    console.log(`Starting to fetch data from Drupal`);
    const data = yield axios.get(`${baseUrl}/${apiBase}`, {
      auth: basicAuth
    });
    const allData = yield Promise.all(_.map(data.data.list,

Link to repo that works on local computer https://github.com/nicholastorr/gatsby-d7

any and all help will be appreciated

4
  • Does it also build correctly locally? (localhost:9000) Commented Mar 1, 2022 at 17:50
  • yes builds perfectly generates 200k nodes Commented Mar 1, 2022 at 17:59
  • What version of Node are you running locally? Commented Mar 1, 2022 at 18:32
  • node v14.17.1 npm 6.14.13 Gatsby CLI version: 4.6.0 Gatsby version: 4.6.0, I also added those specific node versions to my NODE_ENV variables and engines in package.json Commented Mar 1, 2022 at 18:41

2 Answers 2

1

As you pointed out, you've played around with the Node versions using NODE_ENV and engines workarounds. My guess also relies on a mismatching Node version between environments but as Netlify docs suggests, there are only two ways of customizing Node versions to manage dependencies.

  • Set a NODE_VERSION environment variable.
  • Add a .node-version or .nvmrc file to the site’s base directory in your repository. This will also tell any other developer using the repository which version of Node.js it depends on.

Without seeing your Netlify build command (to see the NODE_VERSION) there's no .node-version nor .nvmrc in your repository. I'd try creating it at the root of the project with the v14.17.1 in it and trying a fresh install.

In addition, double-check other server-related conflicts like IP-blocking, etc.

2
  • 4:27:37 PM: Downloading and installing node v14.17.1... 4:27:37 PM: Downloading nodejs.org/dist/v14.17.1/node-v14.17.1-linux-x64.tar.xz... 4:27:38 PM: Computing checksum with sha256sum 4:27:38 PM: Checksums matched! 4:27:41 PM: Now using node v14.17.1 (npm v6.14.13) 4:27:43 PM: Using PHP version 8.0 4:27:43 PM: Started restoring cached node modules 4:27:43 PM: Finished restoring cached node modules 4:27:43 PM: Installing NPM modules using NPM version 6.14.13 Commented Mar 1, 2022 at 18:54
  • It is installing the same node and npm versions as my local computer but still same error Commented Mar 1, 2022 at 18:54
0

Error was nothing Gatsby or Node related, my site was block the IP of the server :>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.