gatsby-source-mysql icon indicating copy to clipboard operation
gatsby-source-mysql copied to clipboard

TypeError: Cannot destructure property `db` of 'undefined' or 'null'.

Open crock opened this issue 5 years ago • 4 comments

ERROR #11321  PLUGIN

"gatsby-source-mysql" threw an error while running the sourceNodes lifecycle:

Cannot destructure property `db` of 'undefined' or 'null'.

   9 |   const { connectionDetails, queries } = configOptions;
  10 | 
> 11 |   const { db, queryResults } = await queryDb(connectionDetails, queries, reporter);
     |         ^
  12 | 
  13 |   try {
  14 |     const sqlData = queries.map((query, index) =>

File: node_modules/gatsby-source-mysql/gatsby-node.js:11:9

TypeError: Cannot destructure property `db` of 'undefined' or 'null'.

System Info


  System:
    OS: macOS 10.15.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.14.0 - ~/.nvm/versions/node/v12.14.0/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.13.4 - ~/.nvm/versions/node/v12.14.0/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 79.0.3945.88
    Firefox: 71.0
    Safari: 13.0.3
  npmPackages:
    gatsby: ^2.18.17 => 2.18.17 
    gatsby-image: ^2.2.37 => 2.2.37 
    gatsby-plugin-disqus: ^1.1.4 => 1.1.4 
    gatsby-plugin-purgecss: ^4.0.0 => 4.0.1 
    gatsby-plugin-react-helmet: ^3.1.18 => 3.1.18 
    gatsby-plugin-sass: ^2.1.26 => 2.1.26 
    gatsby-plugin-sharp: ^2.3.10 => 2.3.10 
    gatsby-plugin-sitemap: ^2.2.24 => 2.2.24 
    gatsby-plugin-styled-components: ^3.1.16 => 3.1.16 
    gatsby-source-filesystem: ^2.1.43 => 2.1.43 
    gatsby-source-mysql: ^2.2.1 => 2.2.1 
    gatsby-source-wordpress: ^3.1.54 => 3.1.54 
    gatsby-transformer-sharp: ^2.3.9 => 2.3.9 
  npmGlobalPackages:
    gatsby-cli: 2.8.22

crock avatar Dec 29 '19 17:12 crock

How did you solve this issue?

konchak007 avatar Aug 14 '20 11:08 konchak007

solved?

Freddymhs avatar Feb 19 '21 22:02 Freddymhs

solved?

@uNFixeD92 As far as I can tell yes. I re-visited this gatsby plugin a couple of weeks ago for something else and everything seems to be working now.

crock avatar Feb 22 '21 19:02 crock

not work if download starter example and ad mysql plugin.

the problem was in wrong database name

n4an avatar Oct 31 '21 08:10 n4an