Skip to content

Module build failed: UnhandledSchemeError when using gatsby function #38481

@Talaxy009

Description

@Talaxy009

Preliminary Checks

Description

I'm trying to write a gatsby function, but it seems like webpack can't compile it.

image
image

I have create a repo which is base on hello-world starter and add a tiny function in it to reproduce this issue, you can find the link below.

Reproduction Link

https://github.com/Talaxy009/gatsby-function-issue

Steps to Reproduce

  1. Clone Reproduction Link
  2. Install dependencies
  3. Run gatsby develop
  4. Visit http://localhost:8000/api/hello
  5. You should be able to see the error from the browser and console

Expected Result

The /api/hello should return "hello"

Actual Result

The /api/hello return error message from webpack

Environment

System:
    OS: Windows 10 10.0.22621
    CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor              
  Binaries:
    Node: 18.16.1 - ~\AppData\Local\Temp\xfs-98c1ccf6\node.CMD
    Yarn: 3.6.3 - ~\AppData\Local\Temp\xfs-98c1ccf6\yarn.CMD
    npm: 9.5.1 - D:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 3.10.9
  Browsers:
    Edge: Spartan (44.22621.2134.0), Chromium (116.0.1938.54)
  npmPackages:
    gatsby: ^5.12.1 => 5.12.1

Config Flags

Nope

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: confirmedIssue with steps to reproduce the bug that’s been verified by at least one reviewer.type: bugAn issue or pull request relating to a bug in Gatsby

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions