Type
Video
What is the error number?
10004
What is the error message?
invalid character ‘-’ in numeric literal
What is the issue you’re encountering
I’m trying to upload a video file to Cloudflare Stream using the API in Laravel, but I’m receiving the following error response:
What are the steps to reproduce the issue?
Here is my laravel code
Route::post(‘/t’, function (Request $request) {
// Call Cloudflare API to upload the
$videoFile = $request->file('file');
$response = Http::withHeaders([
'Authorization' => 'Bearer <token>',
])
->attach('file', fopen($videoFile->getRealPath(), 'r'), $videoFile->getClientOriginalName())
->post('https://api.cloudflare.com/client/v4/accounts/<id>/stream/videos');
dd($response->body());
if ($response->successful()) {
$data = $response->json();
// Return the video ID to the frontend
return response()->json(['data' => $data], 201);
} else {
return response()->json(['error' => 'Failed to upload video'], 500);
}
});
and here is the response from cloudflare
{
“result”: null,
“success”: false,
“errors”: [
{
"code": 10004,
"message": "Decoding Error: A portion of the request could be not decoded. Refer to the messages field for more information and try again."
}
],
“messages”: [
{
"code": 10004,
"message": "invalid character '-' in numeric literal"
}
]
}