Adding an image to an episode results in error SharedArrayBuffer is not defined and an empty image preview. Trying to use the selection by clicking "Use this image" results in an upload error.
Uploading a new image also results in the same error and an empty preview but after filling the necessary fields the image can be set with "Use this image".
Steps to Reproduce
Case 1:
Edit an episode
Click: "Choose image"
Click: "Browse Images"
Select an image uploaded earlier
Case 2:
Edit an episode
Click: "Choose image"
Click: "Upload new image"
Select an image
Expected Result
The image to be shown in the preview with enabled editing functions.
Actual Result
Empty image preview. Clicking "Use this image" results in an error banner with text: "Could not upload image."
Environment
Aura 1.0.0-alpha5 on Ubuntu 24.04.1 in a virtual machine
macos 10.15.7, Firefox 132.0.2, Chrome 128.0.6613.138
Edited
Designs
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
May I ask you to share some browser console logs during the image upload operation? Additionally you have have some relevant logs from Steering at the same time.
Sure, here is the browser log when an image gets loaded into the preview:
ReferenceError: SharedArrayBuffer is not defined vips.worker.hash-3916a6f5.js:5:8380 Vips http://auravm.local/vips.worker.hash-3916a6f5.js:5 <anonymous> http://auravm.local/vips.worker.hash-3916a6f5.js:28
And these are the related lines from docker compose logs:
nginx-1 | 10.20.0.10 - - [29/Nov/2024:09:42:38 +0100] "GET /steering/api/v1/licenses/? HTTP/1.1" 200 1600 "http://auravm.local/shows/1/episodes/19/details" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:132.0) Gecko/20100101 Firefox/132.0"nginx-1 | 10.20.0.10 - - [29/Nov/2024:09:42:38 +0100] "GET /steering/api/v1/licenses/3/ HTTP/1.1" 200 219 "http://auravm.local/shows/1/episodes/19/details" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:132.0) Gecko/20100101 Firefox/132.0"
The use of the image editor requires AURA to run on something browsers call a secure context (loosely: requires https://). This is because the image library we use for editing images operates in a web worker using the SharedArrayBuffer browser API, which is only available in these secure contexts. This is a restriction that was made after the spectre CPU bugs surfaced.
Usually localhost is also a secure context, but you’re using the aura.local hostname, which is not included. Chromium-based browsers like Chrome, Edge, and Vivaldi allow you to set exemptions by adding the origin (in your case http://aura.local) to the list under the Insecure origins treated as secure setting in chrome://flags for debugging purposes. But obviously, this doesn’t scale.
UI-wise we could deactivate these features if SharedArrayBuffer is not defined in the current browser environment, or at least display a warning.
Thanks for your explanation! I set the security exception in chrome and now it works.
I experience quite long loading times if an image gets loaded (a couple of seconds). The browser console tells me: [vips.worker] loading Vips. Is this to be expected? Is this related to the machine aura is running on or is it related to the network?
Vips is a originally a C-library and comes as a rather bulky 6MB WASM-library, so loading speed may depend on the speed of the network connection. Therefore it’s only loaded if the user is actually editing an image. Locally, it should be quick to load. It should also be quick to load, if the user ever opened the image editor before because we set a proper cache header for assets.
All image operations are performed in the browser so that will actually depend on the processing power of the client.
It might be helpful if you post the log output that starts with [vips.worker] (including timestamps) because then I can say more about what is actually taking long.
It’s okay for these to show up multiple times in the network view. They are imported every time a worker is spawned for image editing (we can’t do that on the main UI thread because we would freeze up the entire UI while editing images). The important part is that these files are properly cached so they are not downloaded every time a worker is spawned. The requests will still show up in the network panel but should have very short response times, because the browser figures out that it should use the cached version (because the server told it so in the Cache-Control response header for the resource – you can even see that in your screenshot).
I’ve tested this with Firefox and Chromium on dashboard.aura.radio and it looks good for me:
If you still see these files downloaded every time you open the image editor, please check if you may have set the Disable cache flag in the network panel. It’s very helpful during debugging but will obviously override the default caching behavior of your browser if activated. It should however not affect the browser’s behavior if you don’t have the dev tools open.