Skip to content

Commit

Permalink
Add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh-mn-yral committed Jul 23, 2024
1 parent ba6d5cf commit ae49e22
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/workers/video/getVideoUploadURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@ const watermarks = {

const handler = async (request) => {
try {
console.log('request received')
const requestBody = await request.json()

if (!requestBody.principalId || !requestBody.fileName) {
console.log('no principalId or no fileName')
console.error('no principalId or no fileName')
return new Response('Bad Request', {
status: 400,
headers: { ...request.corsHeaders },
})
}

console.error('requestbody', requestBody.principalId, requestBody.fileName)

// eslint-disable-next-line no-undef
console.error('Cloudflare account ID', CLOUDFLARE_ACCOUNT_ID)

const cloudflareGenerateUploadURLResponse = await (
await fetch(
// eslint-disable-next-line no-undef
Expand All @@ -28,7 +34,7 @@ const handler = async (request) => {
body: JSON.stringify({
maxDurationSeconds: 60,
watermark: {
uid: watermarks.upperLeft_P05_O40_S08,
uid: watermarks.yral,
},
meta: {
creator: requestBody.principalId,
Expand All @@ -40,6 +46,8 @@ const handler = async (request) => {
)
).json()

console.log('response', JSON.stringify(cloudflareGenerateUploadURLResponse))

return new Response(JSON.stringify(cloudflareGenerateUploadURLResponse), {
status: 200,
headers: {
Expand Down

0 comments on commit ae49e22

Please sign in to comment.