Error using XMLSerializer from jsdom / jsdom-global
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 9.8k
- Forks
- 326
- PR merge metrics
- No merged PRs in 30d
Description
I have attached jsdom-ncc-issue.zip which reduces this issue to the smallest amount of code I could reproduce this in.
If you run:
npm install
npm run build
node ./build/server.js
and then visit http://localhost:8080 you will get a simple blue SVG square with a green outline.
If you run:
npm install
npm run package
node ./dist/index.js
and then visit http://localhost:8080, you will get
Example app listening at http://localhost:8080
(node:58932) UnhandledPromiseRejectionWarning: TypeError: Object prototype may only be an Object or null: undefined
at Function.create (<anonymous>)
at new XMLSerializer (R:\dev\jsdom-ncc-issue\webpack:\jsdom-ncc-issue\node_modules\jsdom\lib\jsdom\living\generated\XMLSerializer.js:90:1)
at R:\dev\jsdom-ncc-issue\webpack:\jsdom-ncc-issue\src\server.ts:34:1
at Layer.handle [as handle_request] (R:\dev\jsdom-ncc-issue\webpack:\jsdom-ncc-issue\node_modules\express\lib\router\layer.js:95:1)
at next (R:\dev\jsdom-ncc-issue\webpack:\jsdom-ncc-issue\node_modules\express\lib\router\route.js:137:1)
at Route.dispatch (R:\dev\jsdom-ncc-issue\webpack:\jsdom-ncc-issue\node_modules\express\lib\router\route.js:112:1)
at Layer.handle [as handle_request] (R:\dev\jsdom-ncc-issue\webpack:\jsdom-ncc-issue\node_modules\express\lib\router\layer.js:95:1)
at R:\dev\jsdom-ncc-issue\webpack:\jsdom-ncc-issue\node_modules\express\lib\router\index.js:281:1
at Function.process_params (R:\dev\jsdom-ncc-issue\webpack:\jsdom-ncc-issue\node_modules\express\lib\router\index.js:335:1)
at next (R:\dev\jsdom-ncc-issue\webpack:\jsdom-ncc-issue\node_modules\express\lib\router\index.js:275:1)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:58932) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
NCC seems to be changing jsdom in some way which breaks XMLSerializer. I haven't been able to dig deep enough to provide any additional insight, but the sample project should at least make the issue reproducible.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the attached reproduction with npm run build and npm run package, then compare the working server output with the packaged failure. Inspect src/server.ts and jsdom's generated XMLSerializer.js in the reproduced project to determine what packaging changes; done means the packaged server starts without the XMLSerializer error and still serves the SVG.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- express, javascript, typescript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100