Skip to content

Clean up build-time API calls to Open Processing #831

Open
@clairep94

Description

@clairep94

Cleanup post-resolution of failed builds (edited on May 14th):

Following the patch-fix to resolve builds hitting OP rate limits and discussions around updates to the api/sketch/[id] and api/curation/sketches, there are a few follow-up tasks for final cleanup:

  1. OP: Update the data returned for the following endpoints in:
// `/api/sketch/:id`
fullname: string
// `/api/curation/:curationId/sketches`
licence: string
  1. p5.js-website: Clean up getSketch to remove license: '' from below:
//https://github.com/processing/p5.js-website/blob/main/src/api/OpenProcessing.ts#L90-L94
if (memoizedSketch) {
      return {
        ...memoizedSketch,
        license: "", // take this out
      } as OpenProcessingSketchResponse;
    }
  1. p5.js-website: Decouple SketchLayout and SketchesLayout by removing authorName from SketchLayout props
// intended change on https://github.com/processing/p5.js-website/blob/main/src/layouts/SketchLayout.astro#L18-L24

interface Props {
  sketchId: string;
}

const { sketchId } = Astro.props;
const { title, createdOn, instructions, fullname: authorName } = await getSketch(sketchId);
  1. p5.js-website: Update any types described on https://github.com/processing/p5.js-website/blob/main/src/api/OpenProcessing.ts

Updated issue (last edited May 5th):

After further investigating the original issue below, it seems that the source of PRs failing test in the past week is that when the static site build is happening, and the project is trying to fetch sketch-data from OpenProcessing API, it is hitting 429 Too Many Requests

I've added error logging on data-fetching functions on PR #832, which still fail as expected, but show us the 429 status and error message below.

Image

I have created a patch-fix solution on my fork here, which passes tests/build but we can see in the call-stack that after generating a certain amount of pages for individual sketches, we hit the limit on calls to OpenProcessing API again (please see PR details for screenshots & proposed solutions).

This leads to me believe that the solution may be to copy this issue to the OpenProcessing API repo, which seems to be private, and see if the rate-limit can be raised by 25 hits/10 minutes when being hit for site-builds. I have also proposed a second solution on clairep94#2, which could greatly reduce the amount of hits to OpenProcessing API that a build requires, but which would require some refactoring on the website & update to the API spec for getCurationSketches

Keen to hear everyone's thoughts!


Original Issue:

Potential bug with builds failing locally and on GHA when generating pages for some sketches

Most appropriate sections of the p5.js website?

Community (Sketches, Libraries, Events)

What is your operating system?

Mac OS

Web browser and version

Not an issue on the production site, but with build on GHA & locally

Actual Behavior

I noticed that some PR's created in the last week have been failing on a similar error to below, and the changes in the PRs seem unrelated to the errors.

Image

I tried to build from main locally and encountered the same error, but with varying sketch ids.

I then tried to make a test PR with a nominal change (added a period in some homepage text), and encountered the same error, so potentially there may be something with the metadata of this sketch 2225254, or another source that is having a side-effect of this sketch page failing on build.

Affected PR Failing Sketch ID & Stack Trace
#820 2225254
#821 2225254
#824 2225254
#826 2225254
#828 2225254
#830 (Test PR) 2225254

Expected Behavior

Build should not fail unless there is a breaking change on the branch
Test failures should vary between PRs given they are working on different issues

Steps to reproduce

  • Pull from main & run npm run build locally, or make PR into main
  • Might be good for someone to try this locally a few times to confirm if it is the same sketch ID that is failing each time, or if it varies.

Would you like to work on the issue?

Happy to look into it further or have it be assigned

Metadata

Metadata

Assignees

Labels

BugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions