-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Description
When uploading videos using the googleapis sdk in Deno Runtime, video uploads stuck at some point. I've tried with several videos with different sizes. One is stuck at %61, other is %18 etc. Never completes, progresses quickly at first but once stuck, never starts again.
import { google } from 'npm:googleapis';
import fs from 'node:fs'
const filePath = `file.mp4`;
const fileSize = Deno.statSync(filePath).size;
// new google.auth.OAuth2(client_id, client_secret, redirect_uris[0]); credentials also assigned after oauth flow completed
const auth = await getOAuthClient()
const youtube = google.youtube({ version: 'v3', auth });
return youtube.videos.insert({
part: ['snippet', 'status'],
requestBody: {
snippet: {
title,
description: `#shorts ${tags.join(' ')}`,
tags: ['shorts', ...tags],
categoryId: '24',
defaultLanguage: 'en'
},
status: {
privacyStatus: 'private'
},
},
media: {
body: fs.createReadStream(filePath)
}
}, {
onUploadProgress: evt => {
const progress = (evt.bytesRead / fileSize) * 100;
console.log(`${Math.round(progress)}% complete`);
},
size: fileSize
})
/*
Uploading video
4% complete
7% complete
11% complete
15% complete
18% complete
*/
// stuck after that and no more progressingI do think something about file streaming doesn't work as expected in Deno. I don't have time to deep dive into what's wrong but I do think this should be fixed in this SDK itself rather than Deno hence opening this issue in this repository. It'd be great if insert function is compatible with all JS runtimes instead of being Node dependent.
Trying this in Bun Runtime can also shed more light on what's the issue.
Metadata
Metadata
Assignees
Labels
priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.