Closed CodeFromAnywhere closed 9 months ago
How can I help debug this? Maybe do you need the raw body and headers?
this is just a guess but maybe it is be that .clone()
and .formData()
don't work together. can you try this like request?.formData()
?
this is just a guess but maybe it is be that
.clone()
and.formData()
don't work together. can you try this likerequest?.formData()
?
Nah, it seems to be the same. Doesn't clone just create a copy of request so you can do things twice?
EDIT: Weird, you seem to be right. The problem has gone away.
I use Bun(1.0.25) run qwik.js start docs . I click the vote button. expect console log the form inputs, but triggered this bug.
import { component$ } from '@builder.io/qwik';
import { routeLoader$, Form, routeAction$ } from '@builder.io/qwik-city';
export const useJokeVoteAction = routeAction$((props) => {
// Leave it as an exercise for the reader to implement this.
console.log('VOTE', props);
});
export const useDadJoke = routeLoader$(async () => {
const response = await fetch('https://icanhazdadjoke.com/', {
headers: { Accept: 'application/json' },
});
return (await response.json()) as {
id: string;
status: number;
joke: string;
};
});
export default component$(() => {
const dadJokeSignal = useDadJoke();
const favoriteJokeAction = useJokeVoteAction();
return (
<section class="section bright">
<p>{dadJokeSignal.value.joke}</p>
<Form action={favoriteJokeAction}>
<input type="hidden" name="jokeID" value={dadJokeSignal.value.id} />
<button name="vote" value="up">👍</button>
<button name="vote" value="down">👎</button>
</Form>
</section>
);
});
This is deps:
"devDependencies": {
"@builder.io/qwik": "^1.4.0",
"@builder.io/qwik-city": "^1.4.0",
"@types/eslint": "^8.56.2",
"@types/node": "^20.11.0",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"eslint": "^8.56.0",
"eslint-plugin-qwik": "^1.4.0",
"prettier": "^3.1.1",
"typescript": "5.3.3",
"undici": "*",
"vite": "^5.0.11",
"vite-tsconfig-paths": "^4.2.1"
}
Duplicate of #2644
What version of Bun is running?
0.7.3
What platform is your computer?
Linux 5.15.0-60-generic x86_64 x86_64
What steps can reproduce the bug?
I'm using Bun.serve
with the
request.formData`I'm using sendgrid to receive emails in bun but Sendgrid is apparently not giving FormData dat you can parse. Somehow, sometimes it works, sometimes it doesn't.
Before I go more in-depth... maybe you can look at your
request.formData()
or let me know how to use it?Makes it very difficult to get the files of attachments of emails in sendgrid.
What is the expected behavior?
It should parse it even without boundary
What do you see instead?
It throws
TypeError: FormData parse error missing final boundary
Additional information
My code:
It Throws with Sendgrid incoming mail