Observability modules failing with Heroku build step in nodejs works in dev environment

48 Views Asked by At

I've recently tried to add observability modules to my code and I've tried both honeycomb and new relic.

Both work perfectly fine in my dev environment and connect to their respective platform and when I build my front-end code with my web pack configuration it also works.

I'm thinking it has to do with Heroku build step with web pack on their end but I'm unsure how to solve it.

When I try to deploy in production I seem to get the same error from both modules(I reverse the commits each time with both, deployed and doubled checked so I know it's most likely not another factor in the code + it works in dev environment with 0 issues and code hasn't has any issues so far in prod):

Build
Running build
> [email protected] build
> webpack
assets by status 1.89 MiB [cached] 4 assets
orphan modules 364 KiB [orphan] 78 modules
runtime modules 792 bytes 4 modules
modules by path ./node_modules/@babel/polyfill/node_modules/core-js/modules/*.js 190 KiB 273 modules
modules by path ./node_modules/@babel/polyfill/node_modules/core-js/library/ 6.43 KiB 18 modules
modules by path ./node_modules/@babel/polyfill/node_modules/core-js/fn/ 1.29 KiB 11 modules
modules by path ./src/ 536 KiB
./src/pages/create.js 894 bytes [built] [code generated]
+ 3 modules
modules by path ./node_modules/@babel/polyfill/lib/*.js 1.22 KiB
./node_modules/@babel/polyfill/lib/index.js 686 bytes [built] [code generated]
./node_modules/@babel/polyfill/lib/noConflict.js 567 bytes [built] [code generated]
./node_modules/@babel/polyfill/node_modules/core-js/es6/index.js 5.78 KiB [built] [code generated]
./node_modules/@babel/polyfill/node_modules/core-js/web/index.js 157 bytes [built] [code generated]
./node_modules/regenerator-runtime/runtime.js 24.3 KiB [built] [code generated]
ERROR in ./node_modules/axios/lib/axios.js 18:0-46
Module not found: Error: Can't resolve './adapters/adapters.js' in '/tmp/build_64aff3bc/node_modules/axios/lib'
@ ./node_modules/axios/index.js 1:0-35 23:4-9 25:0-43:1
@ ./src/main.js 2:0-26 566:8-38 573:8-53 622:41-46 680:26-31 797:47-52 819:49-54 856:29-34 888:21-26 916:22-27 963:22-27 987:22-27 1028:22-27 1069:22-27 1105:22-27 1141:22-27 1165:22-27 1193:22-27 1216:22-27 1256:22-27 1293:22-27 1319:34-39 1333:25-30 1364:22-27 1390:31-36 1426:27-32 1455:24-29 1477:24-29 1496:24-29 1534:31-36 1548:25-30 1587:22-27 1607:22-27 1632:22-27 1660:22-27 1688:22-27 1716:22-27 1747:22-27 1781:22-27 1837:24-29 3262:22-27 3286:22-27 3315:22-27 3333:22-27 3350:22-27 3368:22-27 3386:22-27 3403:24-29 3420:24-29 3437:22-27
ERROR in ./node_modules/axios/lib/axios.js 19:0-57
Module not found: Error: Can't resolve './helpers/HttpStatusCode.js' in '/tmp/build_64aff3bc/node_modules/axios/lib'
@ ./node_modules/axios/index.js 1:0-35 23:4-9 25:0-43:1
@ ./src/main.js 2:0-26 566:8-38 573:8-53 622:41-46 680:26-31 797:47-52 819:49-54 856:29-34 888:21-26 916:22-27 963:22-27 987:22-27 1028:22-27 1069:22-27 1105:22-27 1141:22-27 1165:22-27 1193:22-27 1216:22-27 1256:22-27 1293:22-27 1319:34-39 1333:25-30 1364:22-27 1390:31-36 1426:27-32 1455:24-29 1477:24-29 1496:24-29 1534:31-36 1548:25-30 1587:22-27 1607:22-27 1632:22-27 1660:22-27 1688:22-27 1716:22-27 1747:22-27 1781:22-27 1837:24-29 3262:22-27 3286:22-27 3315:22-27 3333:22-27 3350:22-27 3368:22-27 3386:22-27 3403:24-29 3420:24-29 3437:22-27
ERROR in ./node_modules/axios/lib/core/dispatchRequest.js 8:0-47
Module not found: Error: Can't resolve '../adapters/adapters.js' in '/tmp/build_64aff3bc/node_modules/axios/lib/core'
@ ./node_modules/axios/lib/core/Axios.js 6:0-51 114:21-41 146:16-36
@ ./node_modules/axios/lib/axios.js 5:0-36 29:22-27 30:24-47 33:25-40 50:14-19
@ ./node_modules/axios/index.js 1:0-35 23:4-9 25:0-43:1
@ ./src/main.js 2:0-26 566:8-38 573:8-53 622:41-46 680:26-31 797:47-52 819:49-54 856:29-34 888:21-26 916:22-27 963:22-27 987:22-27 1028:22-27 1069:22-27 1105:22-27 1141:22-27 1165:22-27 1193:22-27 1216:22-27 1256:22-27 1293:22-27 1319:34-39 1333:25-30 1364:22-27 1390:31-36 1426:27-32 1455:24-29 1477:24-29 1496:24-29 1534:31-36 1548:25-30 1587:22-27 1607:22-27 1632:22-27 1660:22-27 1688:22-27 1716:22-27 1747:22-27 1781:22-27 1837:24-29 3262:22-27 3286:22-27 3315:22-27 3333:22-27 3350:22-27 3368:22-27 3386:22-27 3403:24-29 3420:24-29 3437:22-27
ERROR in ./node_modules/axios/lib/platform/browser/index.js 3:0-36
Module not found: Error: Can't resolve './classes/Blob.js' in '/tmp/build_64aff3bc/node_modules/axios/lib/platform/browser'
@ ./node_modules/axios/lib/platform/index.js 1:0-39 6:5-13
@ ./node_modules/axios/lib/defaults/index.js 8:0-44 139:14-39 140:10-31
@ ./node_modules/axios/lib/axios.js 7:0-43 47:29-37
@ ./node_modules/axios/index.js 1:0-35 23:4-9 25:0-43:1
@ ./src/main.js 2:0-26 566:8-38 573:8-53 622:41-46 680:26-31 797:47-52 819:49-54 856:29-34 888:21-26 916:22-27 963:22-27 987:22-27 1028:22-27 1069:22-27 1105:22-27 1141:22-27 1165:22-27 1193:22-27 1216:22-27 1256:22-27 1293:22-27 1319:34-39 1333:25-30 1364:22-27 1390:31-36 1426:27-32 1455:24-29 1477:24-29 1496:24-29 1534:31-36 1548:25-30 1587:22-27 1607:22-27 1632:22-27 1660:22-27 1688:22-27 1716:22-27 1747:22-27 1781:22-27 1837:24-29 3262:22-27 3286:22-27 3315:22-27 3333:22-27 3350:22-27 3368:22-27 3386:22-27 3403:24-29 3420:24-29 3437:22-27
ERROR in ./node_modules/axios/lib/platform/index.js 2:0-43
Module not found: Error: Can't resolve './common/utils.js' in '/tmp/build_64aff3bc/node_modules/axios/lib/platform'
@ ./node_modules/axios/lib/defaults/index.js 8:0-44 139:14-39 140:10-31
@ ./node_modules/axios/lib/axios.js 7:0-43 47:29-37
@ ./node_modules/axios/index.js 1:0-35 23:4-9 25:0-43:1
@ ./src/main.js 2:0-26 566:8-38 573:8-53 622:41-46 680:26-31 797:47-52 819:49-54 856:29-34 888:21-26 916:22-27 963:22-27 987:22-27 1028:22-27 1069:22-27 1105:22-27 1141:22-27 1165:22-27 1193:22-27 1216:22-27 1256:22-27 1293:22-27 1319:34-39 1333:25-30 1364:22-27 1390:31-36 1426:27-32 1455:24-29 1477:24-29 1496:24-29 1534:31-36 1548:25-30 1587:22-27 1607:22-27 1632:22-27 1660:22-27 1688:22-27 1716:22-27 1747:22-27 1781:22-27 1837:24-29 3262:22-27 3286:22-27 3315:22-27 3333:22-27 3350:22-27 3368:22-27 3386:22-27 3403:24-29 3420:24-29 3437:22-27
5 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
webpack 5.89.0 compiled with 5 errors in 11223 ms
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- node_modules checked into source control
https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits
- Node version not specified in package.json
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
1

There are 1 best solutions below

0
MandoMando On

May have resolved this issue. Was importing axios from node module to be bundled for front end and seems webpack build environment was different. Used a minified axios code for browser and placed it in a separate file then imported it into the file that will be bundled. Think it has to do with axios webpack compatibility for newer versions as it seems when I used the observability modules they try to support the newer version too which results in the issue when bundling. Using 1.1.2 but when observability modules came in both used the latest version while maintain 1.1.2.

Unsure of what's different with Heroku environment still that causes this but making axios a prebuilt minified package import worked.