question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Serve dzi from S3 storage

See original GitHub issue

Hi,

I’m trying to serve dzi file stored in s3 storage and getting errors below.

s3 storage

s3://s3-storage/hyper-resolution-image/sample.dzi s3://s3-storage/hyper-resolution-image/sample_files/{level}/{x}_{y}.jpeg

sample.dzi

<?xml version="1.0" encoding="UTF-8"?>
<Image xmlns="http://schemas.microsoft.com/deepzoom/2008"
  Format="jpeg"
  Overlap="1"
  TileSize="254"
  >
  <Size
    Height="42669"
    Width="58073"
  />
</Image>

get signed url from s3 storage

function s3_bucket_url_js (key: string) {
    let url = s3.getSignedUrl('getObject', {
      Bucket: "s3-storage",
      Expires: 60*30,
      Key: key,
    }, function (err, url) {
      if(err) {
        console.log(err)
      } else {
        console.log(url)
      } 
    })
    return url
  }

initialize openseadragon viewer

let viewer : OpenSeadragon = OpenSeadragon({
      id: "viewer",
      prefixUrl: "//openseadragon.github.io/openseadragon/images/",
      tileSources: {
        height: 42669,
        width: 58073,
        tileSize: 254,
        overLap: 1,
        getTileUrl: function (level : Number, x : Number, y : Number) {
          let url_s = "hyper-resolution-image/sample_files/" + level + "/" + x + "_" + y + ".jpeg"
          return s3_bucket_url_js(url_s)
        },
      }
    })

I’m getting two errors like below.

  1. tile.js:136 Tile constructor needs ‘cacheKey’ variable: creation tile cache in Tile class is deprecated. TileSource.prototype.getTileHashKey will be used. (tile.js:136)
  2. Assertion failed: [TileCache.getImageRecord] cacheKey is required (tilecache.js:237)

have any idea about this error or how to serve dzi from s3 storage?

Thank you.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
SamHallcommented, Oct 18, 2022

I serve up all my deep zoom images via S3. I have all folders and .dzi files in a publicly accessible bucket. Also requires setting cross-origin resource sharing (CORS) for my domain(s).

Best practice? Certainly not, but have not had any issues in over 8 years. The cost is miniscule.

You can view the source on many pages of my site: https://chattanoogahistory.com

Example:

var viewer = new OpenSeadragon.Viewer({
            id: "openseadragon-canvas",
            prefixUrl: "/openseadragon/images_TEST/",
            tileSources: [    
              "https://s3.amazonaws.com/dzchattzoom/024_B2.dzi", <!-- pg00 -->
              "https://s3.amazonaws.com/dzchattzoom/060_B2.dzi", <!-- pg01 -->
              "https://s3.amazonaws.com/dzchattzoom/078_B3.dzi"<!-- pg02 -->
            ],
0reactions
Aiosacommented, Oct 20, 2022

@FrostScent we want to solve it nevertheless, since it might be an inconsistent/ faulty behaviour. I can see you are afraid of debugging - in JavaScript this is easy and fast, much faster than writing this post here. If you open the browser inspector window (f12) find in sources tab the tileSource.js file, set a breakpoint on the method we discuss and run it you see what goes wrong immediately. ~20 seconds.

Btw. learning how to do this will save you a lots of time in the future.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Openseadragon Zoomify tile source with AWS S3 presigned ...
I reference the .dzi file as a tilesource. To use it this way, I had to make the permissions 'public'. S3 warns against...
Read more >
Access deep zoom images stored on AWS S3 from JS
We are trying to serve large deep zoom images from our private S3 bucket and view them in a browser with an appropriate...
Read more >
Crop images at max resolution from DZI pyramid
Hello, I currently use vips to crop regions from .SVS files based on the x, y. width and height. vips crop slide.svs crop.jpeg...
Read more >
Serverless Architecture for a Web Scraping Solution - AWS
We have at least two options to consider: on-premises (such as on your local machine, a Raspberry Pi server at home, a virtual...
Read more >
full-res pan-and-zoom JS viewer on a sufia/hyrax app
They are stored (for better or worse) as TIFFs with no ... fairly expensive server resources to handle heavy load; the pre-generated DZI...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found