Non-256KiB chunk size multiple Error direct creator upload using TUS

I’m trying to do direct creator uploads using TUS.
I get the following error message and it doesn’t work.

  "result": null,
  "success": false,
  "errors": [
      "code": 10031,
      "message": "Non-256KiB chunk size multiple"
  "messages": null

I am using tus-js-client and the code is as follows

    const videoRes = await fetch(videoPath);
    const blob = await videoRes.blob();

    const upload = new Upload(blob, {
      chunkSize: 5242880,
      metadata: {
        filename: "testvideoname",
        filetype: blob.type,
      onError: (error) => {
      onProgress: (bytesUploaded, bytesTotal) => {
        var percentage = ((bytesUploaded / bytesTotal) * 100).toFixed(2);
        console.log(bytesUploaded, bytesTotal, percentage + "%");
      onSuccess: () => {
        console.log("Download %s from %s",, upload.url);

I’m using one-time upload URL as endpoint

I thought it was because the file size to be uploaded was smaller than the chunk size that I had set, but it worked when I used the following API with the same settings to upload.{ACCOUNT ID}/stream

What is the problem?

If you are using one-time uploads feature, can you confirm that you have created your own endpoint that calls the Stream API request the one-time upload URL? You can find an example here:

The code to get the the one-time upload URL is below

import type { NextApiRequest, NextApiResponse } from "next";

const getTmpUploadUrl = async (req: NextApiRequest, res: NextApiResponse) => {
  try {
    const uploadLength = req.headers["upload-length"];
    const uploadMetadata = req.headers["upload-metadata"];
    if (!uploadLength || !uploadMetadata || typeof uploadLength !== "string" || typeof uploadMetadata !== "string") {
      return res.status(400).json({ result: "ng", message: "invalid header." });
    const response = await fetch(
        method: "POST",
        headers: {
          Authorization: `bearer ${process.env.CLOUDFLARE_SECRET_TOKEN}`,
          "Tus-Resumable": "1.0.0",
          "Upload-Length": uploadLength,
          "Upload-Metadata": uploadMetadata,

    const destination = response.headers.get("Location");
		if (!destination) return res.status(500).json({result: "ng", message: "Location Header is null."});

		res.setHeader("Location", destination);
    return res.status(200).json({ result: "ok" });
  } catch (error) {
    return res.status(500).json({ result: "ng", message: "unexpected error." });

export default getTmpUploadUrl;

And an example of one-time upload URL is below

I misunderstood the specification of the endpoint.
I should have specified the endpoint of the API I created.