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

Uploading a file always appears as application/octet-stream #6916

Closed
leadream opened this issue May 22, 2022 · 1 comment
Closed

Uploading a file always appears as application/octet-stream #6916

leadream opened this issue May 22, 2022 · 1 comment
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@leadream
Copy link

leadream commented May 22, 2022

Bug report

Updates

Seems it only happens in Cloudflare workers. I tried it in a normal NodeJs environment and it works well.

Describe the bug

I tried to upload a file from a URL in Node.js. I always get an object with application/octet-stream mime type. Here is my code:

const { createClient } = require('@supabase/supabase-js')

const supabase = createClient('SUPABASE_URL', 'SUPABASE_ANON_KEY')

async function upload (url) {
    const blob = await fetch(url)
        .then(response => response.blob())
    const fileName = 'test.' +blob.type.split('/')[1]
    const result = await supabase
      .storage
      .from('avatars')
      .upload(fileName, blob, {
        cacheControl: '3600',
        contentType: blob.type,
        upsert: true,
      })
      console.log(result)
}

upload('https://tinypng.com/images/panda-happy-2x.png')

image

To Reproduce

Copy this code and run it in Cloudflare workers.

@leadream leadream added the bug Something isn't working label May 22, 2022
@leadream
Copy link
Author

Related issue: cloudflare/workers-sdk#1085

@egor-romanov egor-romanov added the wontfix This will not be worked on label Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants