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

[Bug?]: TypeError: Response body object should not be disturbed or locked #1578

Closed
2 tasks done
artecoop opened this issue Jul 11, 2024 · 3 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@artecoop
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

Hey!
I'm experimenting with the new Solid Start 1.0 and hit a problem while trying to upload a simple file. For example

import { action } from '@solidjs/router';

const uploadFile = action(async (data) => {
	'use server';
	console.log(data);
});

export default function () {
	return (
		<form method="post" action={uploadFile} enctype="multipart/form-data">
			<input type="file" name="file_upload" />
			<button type="submit">Upload</button>
		</form>
	);
}

Give me the error

[h3] [unhandled] TypeError: Response body object should not be disturbed or locked
    at extractBody (node:internal/deps/undici/undici:4151:17)
    ... 5 lines matching cause stack trace ...
    at async Server.toNodeHandle (file:///Users/dev/solo/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:2249:7) {
  cause: TypeError: Response body object should not be disturbed or locked
      at extractBody (node:internal/deps/undici/undici:4151:17)
      at new Request (node:internal/deps/undici/undici:5084:48)
      at handleServerFunction (/Users/dev/solo/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]_@[email protected]_@types+n_fqrivpjm2ut6pdcgwnam6j2nza/node_modules/@solidjs/start/dist/runtime/server-handler.js:85:64)
      at async _callHandler (file:///Users/dev/solo/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:1821:16)
      at async file:///Users/dev/solo/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:1962:19
      at async Object.callAsync (file:///Users/dev/solo/node_modules/.pnpm/[email protected]/node_modules/unctx/dist/index.mjs:72:16)
      at async Server.toNodeHandle (file:///Users/dev/solo/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:2249:7),
  statusCode: 500,
  fatal: false,
  unhandled: true,
  statusMessage: undefined,
  data: undefined
}

Expected behavior 🤔

No response

Steps to reproduce 🕹

Steps:

Context 🔦

No response

Your environment 🌎

macos 14.5 on mac mini M1
node 20.15.1
pnpm 9.5.0
@solidjs/meta: "^0.29.4"
@solidjs/router: "^0.14.1"
@solidjs/start: "^1.0.3"
solid-js: "^1.8.18"
vinxi: "^0.3.14"
@artecoop artecoop added the bug Something isn't working label Jul 11, 2024
@madaxen86
Copy link

This PR should fix it.
#1577
Until then use version 1.0.2
That fixed it for me.

@artecoop
Copy link
Author

Thanks mate, downgrading fixes the problem

@ryansolid
Copy link
Member

Fixed in 1.0.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants