Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

let headers = new Headers() returning undefined in @servicestack node modules #384

Open
5 tasks done
da-cade opened this issue Nov 30, 2023 · 0 comments
Open
5 tasks done

Comments

@da-cade
Copy link

da-cade commented Nov 30, 2023

Describe the bug

Attempted to run npm run build:local from ProjectName/ui

An internal error occurred.
[vite-ssg] Please report an issue, if none already exists: https://github.com/antfu/vite-ssg/issues
~\ProjectName\ui\node_modules@servicestack\client\dist\index.js:631
this.headers = new Headers();
^

ReferenceError: Headers is not defined
at new JsonServiceClient (~\ProjectName\ui\node_modules@servicestack\client\dist\index.js:631:28)

let headers = new Headers(); headers.set("Content-Type", "text/plain");

Since it is a node-module, adjusting locally would be pointless. After some searching, the typical solution for this is to populate the Headers object with a prior await fetch.Headers( )

Reproduction

Follow the steps located at https://vue-ssg.jamstacks.net/, and attempt to build. All other steps run fine.

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 AMD Ryzen 9 4900HS with Radeon Graphics
    Memory: 5.59 GB / 15.42 GB
  Binaries:
    Node: 16.15.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 9.6.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.3636.0), Chromium (119.0.2151.97)
    Internet Explorer: 11.0.19041.3636

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant