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

large uploads fail #8

Closed
good-idea opened this issue Sep 27, 2019 · 11 comments
Closed

large uploads fail #8

good-idea opened this issue Sep 27, 2019 · 11 comments

Comments

@good-idea
Copy link

good-idea commented Sep 27, 2019

Perhaps the same as #5, but, the POST data is showing up fine in the network tab.

I'm uploading a 500mb video file, which is taking about 6 minutes on my connection. After the upload reaches 100%, I see "Unexpected error occurred":

image

In the network tab, the request has failed with a 400 status. Here's what is in the Chrome network tab:

General

Request URL: https://ddpo9nmo.api.sanity.io/v1/addons/mux/assets/production?muxBody=%7B%22input%22%3A%22%22%2C%22playback_policy%22%3A%5B%22public%22%5D%7D&filename=kusama-original.mp4
Request Method: POST
Status Code: 400 
Remote Address: 35.241.31.122:443
Referrer Policy: no-referrer-when-downgrade

Response Headers

access-control-allow-credentials: true
access-control-allow-origin: https://onehundredyearplan.sanity.studio
access-control-expose-headers: Content-Type, Content-Length, ETag, X-Sanity-Deprecated, X-Sanity-Warning
access-control-max-age: 600
alt-svc: clear
content-length: 81
content-type: application/json; charset=utf-8
date: Fri, 27 Sep 2019 17:37:41 GMT
etag: W/"51-BqXby0DlGrHHO5RU6zvKO8edQhI"
status: 400
vary: Origin
via: 1.1 google

Request Headers

Provisional headers are shown
Accept: application/json
Content-Type: video/mp4
DNT: 1
MUX-Proxy-UUID: [redacted]
Origin: https://onehundredyearplan.sanity.studio
Referer: https://onehundredyearplan.sanity.studio/desk/websites;c203233e-ba1f-47f0-bc31-24d727370fe0
Sec-Fetch-Mode: cors
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36

Query String Parameters

muxBody: {"input":"","playback_policy":["public"]}
filename: kusama-original.mp4

The video has successfully uploaded to MUX, it shows up in the dashboard there. But, it's never registered as an asset in Sanity, so it can't be added to the document later.

Edit: I just tried uploading a smaller video (30mb) with the network throttled. It took 5.9 minutes and failed in the same way.

@david-j-davis
Copy link

I'm having the same issue happening repeatedly as well as of today. I'm uploading a video of around 350mb. My videos also successfully upload to Mux dashboard like @good-idea

@evenwestvang
Copy link
Member

Thank you for this – we'll investigate.

@good-idea
Copy link
Author

good-idea commented Oct 3, 2019

@david-j-davis as a little workaround -- if you're using the Structure plugin, you can manually add your Mux assets with a setup like this:

import S from '@sanity/desk-tool/structure-builder'

export default () =>
  S.list()
    .title('My Site')
    .items([
      S.listItem()
        .title('Pages')
        .child(S.documentTypeList('page')),
      S.listItem()
        .title('Videos')
        .child(S.documentTypeList('mux.videoAsset')),
    ])

It's a bit of a "hack", and the display title for all of the documents will be "ready", but you can add a new one, manually enter ready as the status, the asset ID and playback ID, which you can copy from your Mux dashboard:

image

Then, back in your video field, you can select Browse instead of upload, and you should the the thumbnail

@david-j-davis
Copy link

Thanks @good-idea for the back-up plan. My client can wait maybe a week before I'll have to do this if there isn't a fix in place by the Sanity team.

@good-idea
Copy link
Author

@david-j-davis no problem. If it's helpful at all, I wrote a simple CLI for uploading directly to Mux. My client had a big batch of videos to upload, and this made it a lot easier.

https://github.com/good-idea/100-year-plan/tree/master/mux-upload

Packaged as a standalone script (just a zip from my dropbox):

https://www.dropbox.com/s/wdge4i4xalewocg/mux-upload.zip?dl=0

(run that with ./mux-upload my-video.mp4 another-video.mp4)

The Readme there says to create a .env file - you can ignore this if you'd like, I made a recent update that prompts you for your API credentials and saves them to ~/.mux-credentials.

You'll still need to manually enter the asset & playback IDs - but, it wouldn't be too difficult to write another "syncing" script that fetches all of your video assets from MUX and creates the proper documents in Sanity

@skogsmaskin
Copy link
Member

Hi! We have released v.0.2.1 today, which I think will solve these problems. It's using the new resumable direct upload to MUX and should work better for larger files. Let me know if you still experiencing problems. I'm closing this now.

@sachinkaria
Copy link

sachinkaria commented Oct 18, 2019

Still experiencing this issue with larger videos. The assets are successfully uploaded to mux and are hosted there, however, when mux starts processing the video after upload, the error is presented on sanity even though there is no error on mux.

@skogsmaskin
Copy link
Member

skogsmaskin commented Oct 19, 2019

Are you sure you're running the latest version @sachinkaria? What is the error (screenshot please)?

What is the output of cat yarn.lock | grep mux-input ?

Please note that the plugin module must be upgraded manually in order to use the latest version (we bumped it to a new minor version):

If using Yarn:
yarn add [email protected]

Or if using NPM:
npm install --save [email protected]

@sachinkaria
Copy link

sachinkaria commented Nov 21, 2019

Hi @skogsmaskin we narrowed down the issue to the pollUpload - maxTries variable (we set it to 200 to test), for larger videos this worked..

image

Not sure if this helps anyone!

@DanielHirunrusme
Copy link

DanielHirunrusme commented Oct 12, 2023

Hi, trying to upload a 15gb file (5 hours long video) and experiencing a timeout issue as well. It gets about 20% of the way through and then stops. As an alternative, I tried this https://github.com/muxinc/stream.new and was able to successfully upload the file but it does not appear in my Mux library within Sanity. I then tried the above method @good-idea suggested but having trouble with the video because it's perhaps "signed". Any ideas?

Using "sanity-plugin-mux-input": "^2.2.3" and "sanity": "^3.18.0".

Entire package json below

{
  "private": true,
  "scripts": {
    "build": "next build",
    "postbuild": "next-sitemap",
    "dev": "next",
    "dev-local": "npx next dev -H 192.168.1.196 -p 3000",
    "format": "npx prettier --write . --ignore-path .gitignore --cache",
    "lint": "next lint -- --ignore-path .gitignore",
    "lint:fix": "npm run format && npm run lint -- --fix",
    "start": "next start",
    "studio:deploy": "npx vercel env pull && npm --prefix studio run deploy",
    "studio:dev": "npm --prefix studio run start",
    "type-check": "tsc --noEmit"
  },
  "prettier": {
    "semi": false,
    "singleQuote": true
  },
  "dependencies": {
    "@headlessui/react": "^1.7.13",
    "@mux/mux-node": "^7.3.0",
    "@mux/mux-player-react": "^1.11.4",
    "@mux/videojs-kit": "^0.11.4",
    "@portabletext/react": "^2.0.2",
    "@react-pdf/renderer": "^3.1.9",
    "@sanity/block-content-to-react": "^3.0.0",
    "@sanity/color-input": "^3.0.2",
    "@sanity/image-url": "^1.0.1",
    "@sanity/scheduled-publishing": "^1.2.1",
    "@sanity/vision": "^3.8.3",
    "@sanity/webhook": "^2.0.0",
    "algoliasearch": "^4.17.0",
    "auto-text-size": "^0.2.2",
    "classnames": "^2.3.1",
    "date-fns": "^2.29.1",
    "framer-motion": "^10.12.4",
    "hls.js": "^1.4.0",
    "i": "^0.3.7",
    "intl-segmenter-polyfill": "^0.4.4",
    "moment": "^2.29.4",
    "moment-timezone": "^0.5.43",
    "next": "^13.3.0",
    "next-sanity": "^4.1.6",
    "next-sitemap": "^4.1.3",
    "next-use-contextual-routing": "^3.0.1",
    "nextjs-google-analytics": "^2.3.3",
    "npm": "^9.6.5",
    "plyr-react": "^5.2.0",
    "react": "^18.2.0",
    "react-accessible-accordion": "^5.0.0",
    "react-countdown": "^2.3.5",
    "react-dom": "^18.2.0",
    "react-hook-form": "^7.38.0",
    "react-icons": "^4.8.0",
    "react-idle-timer": "^5.6.2",
    "react-instantsearch-dom": "^6.39.1",
    "react-intersection-observer": "^9.4.0",
    "react-modal": "^3.16.1",
    "react-moment-countdown": "^0.4.2",
    "react-player": "^2.12.0",
    "react-tabs": "^5.2.0",
    "reduce-css-calc": "^2.1.8",
    "sanity": "^3.18.0",
    "sanity-algolia": "^1.1.0",
    "sanity-plugin-mux-input": "^2.2.3",
    "satori": "^0.4.7",
    "styled-components": "^5.3.9",
    "suspend-react": "^0.0.9",
    "swiper": "^9.2.0",
    "swr": "^2.1.3",
    "typewriter-effect": "^2.19.0",
    "use-fit-text": "^2.4.0",
    "use-mailchimp-form": "^3.1.0",
    "video.js": "^8.3.0"
  },
  "devDependencies": {
    "@types/node": "18.15.11",
    "autoprefixer": "^10.4.8",
    "eslint": "^8.38.0",
    "eslint-config-next": "^13.3.0",
    "eslint-plugin-simple-import-sort": "^10.0.0",
    "postcss": "^8.4.14",
    "prettier": "^2.8.7",
    "prettier-plugin-packagejson": "^2.4.3",
    "prettier-plugin-tailwindcss": "^0.2.7",
    "react-moment-proptypes": "^1.8.1",
    "tailwindcss": "^3.3.1",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=16"
  }
}

@cordial
Copy link

cordial commented Dec 5, 2023

Hi, trying to upload a 15gb file (5 hours long video) and experiencing a timeout issue as well. It gets about 20% of the way through and then stops. As an alternative, I tried this https://github.com/muxinc/stream.new and was able to successfully upload the file but it does not appear in my Mux library within Sanity. I then tried the above method @good-idea suggested but having trouble with the video because it's perhaps "signed". Any ideas?

Using "sanity-plugin-mux-input": "^2.2.3" and "sanity": "^3.18.0".

Entire package json below

{
  "private": true,
  "scripts": {
    "build": "next build",
    "postbuild": "next-sitemap",
    "dev": "next",
    "dev-local": "npx next dev -H 192.168.1.196 -p 3000",
    "format": "npx prettier --write . --ignore-path .gitignore --cache",
    "lint": "next lint -- --ignore-path .gitignore",
    "lint:fix": "npm run format && npm run lint -- --fix",
    "start": "next start",
    "studio:deploy": "npx vercel env pull && npm --prefix studio run deploy",
    "studio:dev": "npm --prefix studio run start",
    "type-check": "tsc --noEmit"
  },
  "prettier": {
    "semi": false,
    "singleQuote": true
  },
  "dependencies": {
    "@headlessui/react": "^1.7.13",
    "@mux/mux-node": "^7.3.0",
    "@mux/mux-player-react": "^1.11.4",
    "@mux/videojs-kit": "^0.11.4",
    "@portabletext/react": "^2.0.2",
    "@react-pdf/renderer": "^3.1.9",
    "@sanity/block-content-to-react": "^3.0.0",
    "@sanity/color-input": "^3.0.2",
    "@sanity/image-url": "^1.0.1",
    "@sanity/scheduled-publishing": "^1.2.1",
    "@sanity/vision": "^3.8.3",
    "@sanity/webhook": "^2.0.0",
    "algoliasearch": "^4.17.0",
    "auto-text-size": "^0.2.2",
    "classnames": "^2.3.1",
    "date-fns": "^2.29.1",
    "framer-motion": "^10.12.4",
    "hls.js": "^1.4.0",
    "i": "^0.3.7",
    "intl-segmenter-polyfill": "^0.4.4",
    "moment": "^2.29.4",
    "moment-timezone": "^0.5.43",
    "next": "^13.3.0",
    "next-sanity": "^4.1.6",
    "next-sitemap": "^4.1.3",
    "next-use-contextual-routing": "^3.0.1",
    "nextjs-google-analytics": "^2.3.3",
    "npm": "^9.6.5",
    "plyr-react": "^5.2.0",
    "react": "^18.2.0",
    "react-accessible-accordion": "^5.0.0",
    "react-countdown": "^2.3.5",
    "react-dom": "^18.2.0",
    "react-hook-form": "^7.38.0",
    "react-icons": "^4.8.0",
    "react-idle-timer": "^5.6.2",
    "react-instantsearch-dom": "^6.39.1",
    "react-intersection-observer": "^9.4.0",
    "react-modal": "^3.16.1",
    "react-moment-countdown": "^0.4.2",
    "react-player": "^2.12.0",
    "react-tabs": "^5.2.0",
    "reduce-css-calc": "^2.1.8",
    "sanity": "^3.18.0",
    "sanity-algolia": "^1.1.0",
    "sanity-plugin-mux-input": "^2.2.3",
    "satori": "^0.4.7",
    "styled-components": "^5.3.9",
    "suspend-react": "^0.0.9",
    "swiper": "^9.2.0",
    "swr": "^2.1.3",
    "typewriter-effect": "^2.19.0",
    "use-fit-text": "^2.4.0",
    "use-mailchimp-form": "^3.1.0",
    "video.js": "^8.3.0"
  },
  "devDependencies": {
    "@types/node": "18.15.11",
    "autoprefixer": "^10.4.8",
    "eslint": "^8.38.0",
    "eslint-config-next": "^13.3.0",
    "eslint-plugin-simple-import-sort": "^10.0.0",
    "postcss": "^8.4.14",
    "prettier": "^2.8.7",
    "prettier-plugin-packagejson": "^2.4.3",
    "prettier-plugin-tailwindcss": "^0.2.7",
    "react-moment-proptypes": "^1.8.1",
    "tailwindcss": "^3.3.1",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=16"
  }
}

hey, @DanielHirunrusme im having similar issues, did u manage to do it successfully in the end?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants