Stream: refused to get unsafe header "stream-media-id"

I’ve managed to upload with TUS to Cloudflare Stream, but I can’t get the stream-media-id because of this error in Chrome.

This is my code, it is running in a Vue app, so in browser.

Can view it in the network tab though


This is from the Node docs Upload a video file · Cloudflare Stream docs

This is a bug! We’ll fix in a few hours!

This should now be fixed, could you please retry?

Thanks @renan! I’m guessing you had to expose the headers or something like that yeh? I thought it couldn’t possibly be you, it had to be me :slight_smile:

For those following along this is my new code. (Vue App)

onAfterResponse: (req, res) => {
      this.streamId = res.getHeader("stream-media-id");
    }  

But in the interim, I did manage to get it server-side and send to my client as well…as is currently documented.

Yep no problem! The stream-media-id header had to be in access-control-expose-headers list for your Javascript to read it and it was missing due to a mistake on our side :slight_smile:.

Glad it works for you now.

Hi renan,
Reached this page via a google search, I am still running into this issue. It’s not available in the first request i believe, however subsequently it is available.

This is part of the JS file i use to upload videos to a worker
Refused to get unsafe header “stream-media-id”

The stream-media-id header is returned in the very first request that should be made by your server side script.

In your code, it appears you’re trying to read it on the client side.