Skip to content

"mod.require is not a function" Error after upgrading from 5.23.0 to >=5.24.0  #2971

Closed
@sergio-dreamcode

Description

@sergio-dreamcode

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

>=5.24.0

Description

Hello, we use Sentry for our Serverless applications which use NestJS and the nest-raven library that implements an interceptor to catch the errors and report them to Sentry.io and everything is bundled using Webpack. After we upgraded from 5.23.0 to the last version 5.26.0 we noticed that when an exception happens we receive an Internal Server Error and the original Exception is not reported to Sentry.io because it is the Sentry library that is having problems. The backend logs we have are:

  | 2020-10-13T14:51:20.131-04:00 | TypeError: mod.require is not a function
-- | -- | --
  | 2020-10-13T14:51:20.131-04:00 | at dynamicRequire (/var/task/src/adapters/graphql/handler.js:79802:16)
  | 2020-10-13T14:51:20.131-04:00 | at /var/task/src/adapters/graphql/handler.js:79860:39
  | 2020-10-13T14:51:20.131-04:00 | at Array.forEach (<anonymous>)
  | 2020-10-13T14:51:20.131-04:00 | at extractNodeRequestData (/var/task/src/adapters/graphql/handler.js:79845:10)
  | 2020-10-13T14:51:20.131-04:00 | at Module.parseRequest (/var/task/src/adapters/graphql/handler.js:131937:61)
  | 2020-10-13T14:51:20.131-04:00 | at RavenInterceptor.captureGraphQLException (/var/task/src/adapters/graphql/handler.js:645524:42)
  | 2020-10-13T14:51:20.131-04:00 | at Sentry.withScope (/var/task/src/adapters/graphql/handler.js:645514:45)
  | 2020-10-13T14:51:20.131-04:00 | at Hub.withScope (/var/task/src/adapters/graphql/handler.js:654823:13)
  | 2020-10-13T14:51:20.131-04:00 | at callOnHub (/var/task/src/adapters/graphql/handler.js:13438:28)
  | 2020-10-13T14:51:20.131-04:00 | at Module.withScope (/var/task/src/adapters/graphql/handler.js:13572:5)

After analyzing the bundle we noticed that the it happens in the dynamicRequire function specifically when it's called from packages/utils/src/node.ts line 93 which was introduced in version 5.24.0.

Checking the stacktrace it happens when Handlers.parseRequests is called from the Nest-Raven library we use

So far the workaround is to keep using @sentry/[email protected] where the error does not happen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions