processing / processing/p5.js-web-editor

Intermittent asset loading errors in Safari

Open
#3,156 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Priority:High
Dominant language
JavaScript
Stars
1.7k
Forks
1.7k
Avg merge
3d 4h
Merged PRs (30d)
8

Description

p5.js version

1.9.4

What is your operating system?

macOS 14.5

Web browser and version

Safari 17.5

Actual Behavior

We've been experiencing severe problems using the web editor in class, specifically when loading images and fonts.
In a group of 20 students, there's never been a single session without those issues. Most of them are using Macbooks or iMacs.

The issue seems hard to reproduce, because a single sketch sometimes works, and sometimes doesn't. We've been calling it "p5.js server issues", maybe it's a regional thing as well – we're based in Austria/Europe.

This sketch fails for me right now in Safari 17.5: https://editor.p5js.org/groedl/sketches/OGg6QwaFu

Screenshot 2024-06-13 at 17 59 25

The console reveals a CORS issue:
Screenshot 2024-06-13 at 18 00 04

Some additional observations:

  • The sketch works just fine in Chrome 126.
  • The sketch works in Safari when using Private Mode.

The image seems to be loaded using fetch(), so I've tried to do that "manually" here: https://editor.p5js.org/groedl/sketches/86WqYZ9IR

This fails as well, but there are two cases which make the fetch() work:

  1. Adding a trailing slash to the URL – found here: https://stackoverflow.com/a/39875236
  2. Using mode: no-cors.
    Image Link

EDIT: These don't actually fix the issue. Case 1 works with fetch() but results in a 404. no-cors suceeds but returns no data (which is intended with no-cors).

Possibly related issues: #3062, #3089

Expected Behavior

Images should load without issues.

Steps to reproduce
Steps:
  1. Run this sketch in Safari 17.5: https://editor.p5js.org/groedl/sketches/OGg6QwaFu

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the linked sketch OGg6QwaFu in Safari 17.5 and comparing it with Chrome and Safari Private Mode. Inspect the reported CORS failure and review related issues #3062 and #3089; done means images and fonts load reliably in the affected Safari setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.