Rendering Images and hosting custom visualizations from GCP Storage

Knowledge Drop

Last tested: Aug 16, 2019
 

When referencing files from Google Cloud Storage via html, always use storage.googleapis.com instead of storage.cloud.google.com, e.g. for html:

dimension: image {

type: string

sql: '1' ;;

html: <img src="https://storage.googleapis.com/xyz/Static%20Images/a1.png" style="width:415px;" "height:60px"/> ;;

}

And for a custom visualisation:

https://storage.googleapis.com/folder_name/vis/your_vis_name.js

storage.cloud.google.com will work in queries, but will fail in any PDF/PNG rendering. You may see the following error message if you use the expanded URL:

{"error":{"errors":[{"domain":"global","reason":"lockedDomainExpired","message":"Locked Domain Expired"}],"code":401,"message":"Locked Domain Expired"}}

Or for a hosted custom vis image rendering (it will hang for minutes/hours with the following loop):

2019-08-16 11:55:33.602 +0000 [INFO|02271|http] :: Request from <ip address> GET /api/internal/render/job/state/cdf341a5c8c53c2b6fc49a234415863a, {}

2019-08-16 11:55:33.615 +0000 [INFO|02271|db:looker] :: (0.000521s) SELECT Procfile README.md all_cards.json body_after.txt body_before.txt body_during.txt ids.txt jq main.sh tmp FROM `render_job` WHERE (`slug` = 'cdf341a5c8c53c2b6fc49a234415863a') LIMIT 1

2019-08-16 11:55:33.629 +0000 [INFO|02271|db:looker] :: (0.000493s) SELECT Procfile README.md all_cards.json body_after.txt body_before.txt body_during.txt ids.txt jq main.sh tmp FROM `render_job` WHERE (`slug` = 'cdf341a5c8c53c2b6fc49a234415863a') LIMIT 1

2019-08-16 11:55:36.833 +0000 [INFO|00854|db:looker] :: (0.000847s) SELECT Procfile README.md all_cards.json body_after.txt body_before.txt body_during.txt ids.txt jq main.sh tmp FROM `render_job` WHERE (`slug` = 'cdf341a5c8c53c2b6fc49a234415863a') LIMIT 1

2019-08-16 11:55:36.834 +0000 [INFO|00854|render] :: Error occurred while generating this dashboard - contact administrator (error: Render job cdf341a5c8c53c2b6fc49a234415863a[13777] failed [RendererNoRenderFinishedEventReceivedError - retried])

See Google docs for more info: https://cloud.google.com/storage/docs/request-endpoints

All requests to the storage.cloud.google.com URI require authentication. This applies even when allUsers have permission to access an object. If you want users to download anonymously accessible objects without authenticating, use the storage.googleapis.com URI documented in Direct API requests.
Version history
Last update:
‎05-07-2021 09:10 AM
Updated by: