Skip to content

v13 Server Components - Webpack error running data fetching method #43328

@jens-ox

Description

@jens-ox

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:35 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T8101
Binaries:
  Node: 16.18.0
  npm: 8.19.2
  Yarn: 1.22.17
  pnpm: 7.1.8
Relevant packages:
  next: 13.0.6-canary.0
  eslint-config-next: 13.0.5
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

Chrome 107.0.5304.110 (Official Build) (arm64)

Describe the Bug

I'm using simple-git to get the latest commit hash from a remote repo. While this works fine in API routes (see pages/api/hello in the repro repo below), doing so in an app page (see app/page.tsx) causes a server runtime error:

TypeError: (0 , simple_git__WEBPACK_IMPORTED_MODULE_0__.default) is not a function

image

Expected Behavior

I would have assumed that the execution context is the same for server-side data loading and API handlers.

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://github.com/jens-ox/nextjs-bug-app-ssr

To Reproduce

  • clone repo
  • pnpm install
  • pnpm dev
  • GET /api/hello --> works correctly and returns the latest commit hash from the Next.js repo
  • Open http://localhost:3000 in your browser -> will cause server error

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