newrelic-experimental/gatsby-build-newrelic

Error: Cannot find module '../../../gatsby-config' with Gatsby 4.10.1 in TS project

Opened this issue · 0 comments

Description

A new install of gatsby-build-newrelic plugin on our site shows the following error when we build our gatsby site

  Error: Cannot find module '../../../gatsby-config'
  Require stack:
  - ~/website/node_modules/gatsby-build-newrelic/utils/constants.js
  - ~/website/node_modules/gatsby-build-newrelic/gatsby-node.js
  - ~/website/node_modules/gatsby/dist/bootstrap/resolve-module-exports.js
  - ~/website/node_modules/gatsby/dist/bootstrap/load-plugins/validate.js
  - ~/website/node_modules/gatsby/dist/bootstrap/load-plugins/resolve-plugin.js
  - ~/website/node_modules/gatsby/dist/bootstrap/load-themes/index.js
  - ~/website/node_modules/gatsby/dist/bootstrap/load-config/index.js
  - ~/website/node_modules/gatsby/dist/services/initialize.js
  - ~/website/node_modules/gatsby/dist/services/index.js
  - ~/website/node_modules/gatsby/dist/state-machines/develop/services.js
  - ~/website/node_modules/gatsby/dist/state-machines/develop/index.js
  - ~/website/node_modules/gatsby/dist/commands/develop-process.js
  - ~/website/.cache/tmp-3926-k5KIWyRlDSWe
  
  - loader:933 Function.Module._resolveFilename
    node:internal/modules/cjs/loader:933:15
  
  - loader:778 Function.Module._load
    node:internal/modules/cjs/loader:778:27
  
  - loader:1005 Module.require
    node:internal/modules/cjs/loader:1005:19
  
  - helpers:102 require
    node:internal/modules/cjs/helpers:102:18
  
  - constants.js:2 Object.<anonymous>
    [website]/[gatsby-build-newrelic]/utils/constants.js:2:22
  
  - loader:1103 Module._compile
    node:internal/modules/cjs/loader:1103:14
  
  - loader:1157 Object.Module._extensions..js
    node:internal/modules/cjs/loader:1157:10
  
  - loader:981 Module.load
    node:internal/modules/cjs/loader:981:32
  
  - loader:822 Function.Module._load
    node:internal/modules/cjs/loader:822:12
  
  - loader:1005 Module.require
    node:internal/modules/cjs/loader:1005:19
  
  - helpers:102 require
    node:internal/modules/cjs/helpers:102:18
  
  - gatsby-node.js:13 Object.<anonymous>
    [website]/[gatsby-build-newrelic]/gatsby-node.js:13:5
  
  - loader:1103 Module._compile
    node:internal/modules/cjs/loader:1103:14
  
  - loader:1157 Object.Module._extensions..js
    node:internal/modules/cjs/loader:1157:10
  
  - loader:981 Module.load
    node:internal/modules/cjs/loader:981:32
  
  - loader:822 Function.Module._load
    node:internal/modules/cjs/loader:822:12
  

not finished load plugins - 2.059s

error Command failed with exit code 1.

Steps to Reproduce

npm install --save gatsby-build-newrelic
    {
      resolve: 'gatsby-build-newrelic',
      options: {
        NR_LICENSE_KEY: process.env.NEW_RELIC_LICENSE_KEY || '',
        NR_ACCOUNT_ID: process.env.NEW_RELIC_ACCOUNT_ID,
        SITE_NAME: 'website',
        customTags: {
          gatsbySite: true,
          branch: process.env.GIT_BRANCH || 'local',
          stage: process.env.STAGE || 'local',
          isRefresh: process.env.REFRESH_BUILD || false,
          env: process.env.NEW_RELIC_ENV || 'dev',
        },
      },
    },
gatsby build --open-tracing-config-file ./node_modules/gatsby-build-newrelic/zipkin-local.js --graphql-tracing

Expected Behavior

I'd expect some logs to show up in new relic's log section, or at least no errors when running build

Your Environment

Mac OS Big Sur
Gatsby 4.10.1
Typescript project (& gatsby-config / gatsby-node typescript files)

Additional context