question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BitGo Requires Additional Modules - NextJS

See original GitHub issue

When I use BitGo in NextJS projects I get an error that requires me to install multiple dependencies. I tried installing each dependency individually but when I got to fs it kept asking me to install the same fs dependency.

Below is the error produced:

error - ./node_modules/@grpc/grpc-js/build/src/tls-helpers.js:20:0
Module not found: Can't resolve 'fs'

Import trace for requested module:
./node_modules/@grpc/grpc-js/build/src/channel-credentials.js
./node_modules/@grpc/grpc-js/build/src/index.js
./node_modules/@hashgraph/sdk/lib/channel/NodeChannel.cjs
./node_modules/@hashgraph/sdk/lib/client/NodeClient.cjs
./node_modules/@hashgraph/sdk/lib/index.cjs
./node_modules/@bitgo/account-lib/dist/src/coin/hbar/utils.js
./node_modules/@bitgo/account-lib/dist/src/utils/crypto.js
./node_modules/@bitgo/account-lib/dist/src/coin/sol/utils.js
./node_modules/@bitgo/account-lib/dist/src/coin/sol/index.js
./node_modules/bitgo/dist/src/v2/coins/sol.js
./node_modules/bitgo/dist/src/v2/coins/index.js
./node_modules/bitgo/dist/src/v2/coinFactory.js
./node_modules/bitgo/dist/src/index.js
./pages/profile.js

Environment Details

  • OS: Mac Intel 11.5.1
  • Node Version: v16.15.0
  • Yarn Version: v1.22.17
  • BitGoJS Version: ^14.1.0
  • BitGo Environment: N/A

Expected Behavior

NextJS project should build successfully

Current Behavior

The project should build successful and all the dependencies should come in when I add in BitGo into my package.json file.

Possible Solution

I am stuck

Steps to Reproduce

  1. Create a NextJS project npx create-next-app testapp
  2. Install BitGo to the project yarn install bitgo
  3. Open up the index.js file and add the following lines above Home
const BitGo = require('bitgo');
const bitgo = new BitGo.BitGo({accessToken: b9.................81af4256797}); // defaults to testnet. add env: 'prod' if you want to go against mainnet
const result = await bitgo.session();
console.dir(result);

export default async function Home() {

  return (
           ....
image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mmcshinsky-bitgocommented, Jun 6, 2022

You should be able to refer to this folder for all the webpack configuration options.

0reactions
github-actions[bot]commented, Aug 14, 2022

This issue was closed because it has been stalled for 5 days with no activity.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build a MDX-powered blog with Contentlayer and Next
In this article, we'll learn how to use Next.js and Contentlayer to create a static MDX blogging site in this tutorial.
Read more >
@bitgo/unspents: Documentation | Openbase
The class unspents.Dimensions provides a class that helps work with the components required to calculate an accurate estimate of a transaction vSize. Examples....
Read more >
Supported Browsers and Features - Next.js
Supported Browsers and Features. Next.js supports modern browsers with zero configuration. Chrome 64+; Edge 79+; Firefox 67+; Opera 51+; Safari 12+ ...
Read more >
Add an option to output the version that would be published
The problem is that I need to put the version of my project into the built application (via Webpack's DefinePlugin), but the version...
Read more >
Web3 Firmware Engineer $56k - $150k in Palo Alto at BitGo
Responsibilities: Develop and modify code to be deployed to Hardware Security Modules (HSM) in C environment; Support ongoing blockchain feature development by ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found