Importing GLB from a GitHub repository


In previous version of observable I was importing a GLB file from my github repository.

This is the peace of the code I used before, where the boatPath is the url pointing to the source:

    (gltf) => {
      var shipGLTF = gltf.scene;
      shipGLTF.rotation.x = Math.PI / 2;
      shipGLTF.rotation.y = -Math.PI / 2;
      shipGLTF.position.set(-1, 0, 0); = "ModelGLTF";

      if (shipGLTF.material) {
        shipGLTF.material.side = THREE.DoubleSide;

    (xhr) => {
      mutable loaderPecentage = (xhr.loaded / 31780028) * 100;

In the newer version, however, I am not able to import it and by checking the console I noticed I receive a CORS issue problem and error 200. I want to know if there is a new procedure to import it from another source than observable. I saw some solutions using FileAttachment but I would rather prefer to keep with the one I am using.


CORS Proxy fetchp / Tom Larkworthy / Observable (remember to publish and wait a few seconds)

You don’t need a CORS proxy. Just use the following path:

I would also recommend to pin the file to the current version by replacing /master/ with /3624e9c/ (the file’s most recent commit ID).

Note that your current boatPath points to Github’s web interface showing the file, not the file itself. I suspect this is not the actual path used in your original code?

oops, my bad, yeah CORS bypass not required for Github. I did not comprehend the context properly.

Hi @mootari and @tomlarkworthy ,

Thanks for the help. Yes, in fact the url I was pointing was wrong. I had to request from a github open site instead of my own repo:

Thanks for the help!