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.

Building app with version 7.2.0 fails with `js_default(...) is not a function`

See original GitHub issue

When building a Next.js app with @bugsnag/js 6.5.2 everything works well. But then when I update to 7.2.0, I get this error:

> next build
--
448 |  
449 | Creating an optimized production build...
450 | Attention: Next.js now collects completely anonymous telemetry regarding usage.
451 | This information is used to shape Next.js' roadmap and prioritize features.
452 | You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
453 | https://nextjs.org/telemetry
454 |  
455 |  
456 | Compiled successfully.
457 |  
458 | Automatically optimizing pages...
459 | ·[91m
460 | ·[0m·[91m> Build error occurred
461 | ·[0m·[91mTypeError: js_default(...) is not a function
462 | at Module.1TCz (/app/.next/server/static/R0sMxFVhNPx29MuYJo4Mu/pages/_app.js:195:37)
463 | at __webpack_require__ (/app/.next/server/static/R0sMxFVhNPx29MuYJo4Mu/pages/_app.js:23:31)
464 | at Object.0 (/app/.next/server/static/R0sMxFVhNPx29MuYJo4Mu/pages/_app.js:106:18)
465 | at __webpack_require__ (/app/.next/server/static/R0sMxFVhNPx29MuYJo4Mu/pages/_app.js:23:31)
466 | at /app/.next/server/static/R0sMxFVhNPx29MuYJo4Mu/pages/_app.js:91:18
467 | at Object.<anonymous> (/app/.next/server/static/R0sMxFVhNPx29MuYJo4Mu/pages/_app.js:94:10)
468 | at Module._compile (internal/modules/cjs/loader.js:956:30)
469 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
470 | at Module.load (internal/modules/cjs/loader.js:812:32)
471 | at Function.Module._load (internal/modules/cjs/loader.js:724:14)
472 | at Module.require (internal/modules/cjs/loader.js:849:19)
473 | at require (internal/modules/cjs/helpers.js:74:18)
474 | at hasCustomGetInitialProps (/app/node_modules/next/dist/build/utils.js:25:1035)
475 | at /app/node_modules/next/dist/build/index.js:13:3616
476 | at processTicksAndRejections (internal/process/task_queues.js:93:5)
477 | at async Promise.all (index 6)
478 | ·[0m·[91mnpm ·[0m·[91mERR! code ELIFECYCLE
479 | npm·[0m·[91m ·[0m·[91mERR!·[0m·[91m ·[0m·[91merrno·[0m·[91m 1
480 | ·[0m·[91mnpm ·[0m·[91mERR! program-portal@1.10.0 build: `next build`
481 | ·[0m·[91mnpm·[0m·[91m ·[0m·[91mERR!·[0m·[91m Exit status 1
482 | ·[0m·[91mnpm ·[0m·[91mERR!·[0m·[91m
483 | npm·[0m·[91m ·[0m·[91mERR!·[0m·[91m Failed at the program-portal@1.10.0 build script.
484 | npm·[0m·[91m ERR!·[0m·[91m This is probably not a problem with npm. There is likely additional logging output above.
485 | ·[0m·[91m
486 | npm ERR!·[0m·[91m A complete log of this run can be found in:
487 | npm ERR!     /root/.npm/_logs/2020-07-23T19_32_12_306Z-debug.log
488 | ·[0mThe command '/bin/sh -c npm run build' returned a non-zero code: 1

I’m sticking to 6.5.2 for now, but just wanted to let you know.


Image 2020-07-23 at 2 46 20 PM

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
edgarjscommented, Sep 3, 2020

Sorry @mattdyoung I missed your previous message. I have an error boundary component where I have all my Bugsnag configuration:

import React from 'react'
import bugsnag from '@bugsnag/js'
import bugsnagReact from '@bugsnag/plugin-react'
import {
  BUGSNAG_KEY,
  APP_VERSION,
  APP_STAGE
} from '../lib/env'
import store from '../lib/redux/store'

let ErrorBoundary = function (props) {
  return props.children
}

if (BUGSNAG_KEY) {
  const bugsnagClient = bugsnag({
    apiKey: BUGSNAG_KEY,
    appType: 'my-app',
    appVersion: APP_VERSION,
    releaseStage: APP_STAGE,
    beforeSend: function (report) {
      const { currentUser } = store.getState()

      report.user = currentUser

      if (/401|4/.test(report.errorMessage)) {
        report.ignore()
      }
    }
  })
  bugsnagClient.use(bugsnagReact, React)

  ErrorBoundary = bugsnagClient.getPlugin('react')
}

export default ErrorBoundary

In env.js I just define the variables:

export const BUGSNAG_KEY = process.env.NEXT_PUBLIC_BUGSNAG_KEY

And that’s it. When I run npm run build I get that error but only when using 7.2.0. If I switch to 6.5.2 everything works well.

Thanks!

0reactions
edgarjscommented, Sep 8, 2020

Got it, thank you for clarifying!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular firebase hosting AT(...)firestore is not a function
1 Answer 1 · Thanks for your answer. · It's started working when I run ng build --optimization=false · U got error because...
Read more >
Requiring electron outside of main.js causes a TypeError #7300
Electron version: 1.3.5 Operating system: Mint 17 Hello I am using Electron ... existsSync is not a function but it lead to another...
Read more >
Upgrading your build from Gradle 7.x to the latest
Type safe Kotlin DSL accessors generation for precompiled script plugins does not fail the build by default if a plugin requested in such...
Read more >
Known issues with Android Studio and Android Gradle Plugin
This page tracks known issues with Android Studio Dolphin | 2021.3.1 and Android Gradle plugin 7.3.1. If you experience an issue not already...
Read more >
Cisco Firepower Release Notes, Version 7.0
FPR4110 and FPR4115 in disabled state CD App Sync error is Rsync is not ... Cisco ASA FirePOWER Module, FMC and NGIPS SNMP...
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