React-BabylonJS and S3 pre-signed url

I’m one week into babylon js and I’m very exctied about all the possibilities. Currently I’m using react-babylonjs for my project (thanks @brianzinn)

I’m trying to render models using the < Model /> component and everything was working well when I stored my assets in the public folder. But now I have to fetch the asset from s3 using pre-signed url which returns a binary/octet-stream. Any thoughts on how to go about this would be greatly appreciated.

If you can, why not set the content-type in the s3 upload? binary/octet-stream is the default.

Just wanted to call out pre-signed urls work fine in regular LoadAssetContainerAsync

thanks @br-matt for you reply. Do you have a codepen/sandbox?

thanks @brianzinn for your reply. We can’t set the content-type during upload unfortunately :frowning:

Additionally, if I’m referencing the pre-signed URL in the Model Component as shown below, should the rootUrl be the entire pre-signed URL? And can the Model component automatically handle the get request and render the model?

with content-type binary/octet-stream they work?

thanks @br-matt for you reply. Do you have a codepen/sandbox?

Sorry no, that would be a difficult one. Our pre-signed which expire quickly and generated on the fly from BE

with content-type binary/octet-stream they work?

Seems like not, it chose something else:

You will get more community response probably with a new question. react-babylonjs just calls SceneLoader.ImportMesh(…):
react-babylonjs/useSceneLoader.tsx at master · brianzinn/react-babylonjs (github.com)

The <Model ../> component is just a thin wrapper to that hook:
react-babylonjs/Model.tsx at master · brianzinn/react-babylonjs (github.com)

I just got it to work!

Replaced rootUrl param with empty string and sceneFileName with the pre-signed URL. Like so:

2 Likes