Skip to content

Conversation

@boazpoolman
Copy link
Member

@boazpoolman boazpoolman commented Aug 13, 2025

This is a stacked PR, branched off of dev/update-cache-manager.

This PR introduces some changes to make the e2e tests work with v5. After the tests started working again they helped to pin point a regression introduced with the v5 migration of this plugin. Managed to solve that here also.

Update checklist issue: #111

derrickmehaffy and others added 30 commits January 3, 2025 14:04
@derrickmehaffy
Copy link
Contributor

derrickmehaffy commented Aug 13, 2025

I manually published the alpha versions:

  • 5.0.0-alpha.1 (ignore alpha.0, it was very broken)

Alright a few things I've noticed (I can push a few changes):

  • Keyv requires us to add .default to it's requires to support commonJS like: const Keyv = require('keyv').default;
  • Purging cache from the edit view hamburger menu throws a react error:
image
  • The docs from Sacha look out of date as the memory provider needs a maxSize which I assume is just the previous max but renamed (more so just needs documented as a breaking change)

So far though I have gotten caching and cache busting working though I need to do more detailed testing with each feature but:
image
image
image

I'm not sure what's up with the prefixes including keyv (their changelog is weird and their releases don't match the versions so difficult to pin down what breaking changes they have had).

From what I can tell the v4 rest-cache used keyv 3-ish to v4 however with the package updates we are on keyv 5.5.0:
image

@derrickmehaffy derrickmehaffy changed the title Dev/fix e2e tests Core: Update to Strapi 5 stacked Aug 13, 2025
@boazpoolman
Copy link
Member Author

@derrickmehaffy I've now fixed the React error you've mentioned.

It seems on my side Keyv 4 is being preferred over Keyv 5. That's why I didn't run into the issue with .default export.
Scherm­afbeelding 2025-08-14 om 08 38 44

And for that reason it now throws an error.
Scherm­afbeelding 2025-08-14 om 08 42 19

@derrickmehaffy
Copy link
Contributor

Cool, I'll manually do another alpha release today after lunch and start diving into my more in depth testing but so far we are on the right track. I also want to run a security audit and look for any other packages updates we can do without breaking too much.

@derrickmehaffy
Copy link
Contributor

Found a bug @boazpoolman looks like the TTL (maxAge) is broken, it's not setting the TTL in both providers (at least I think on memory, difficult to check)

image

@derrickmehaffy
Copy link
Contributor

I see why, since cache-manager moved to Keyv, the way you pass in the TTL is different. Before we were constructing an options object but they expect just an integer:

https://www.npmjs.com/package/cache-manager#set

What we are doing is:

  async set(key, val, maxAge = 3600) {
    const options = {
      ttl: maxAge * 1000,
    };
    return this.cache.set(key, val, options);
  }

But it should just be

  async set(key, val, maxAge = 3600) {
    return this.cache.set(key, val, maxAge * 1000);
  }

(I think)

@derrickmehaffy
Copy link
Contributor

Yeah that fixed it:
image

I'll push the change

@derrickmehaffy
Copy link
Contributor

Alright so far my testing is pretty well done #111

Going to merge this and get stuff in the right branches

@derrickmehaffy derrickmehaffy merged commit 28b81a5 into dev/strapi5 Sep 5, 2025
2 of 6 checks passed
@derrickmehaffy derrickmehaffy deleted the dev/fix-e2e-tests branch September 5, 2025 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants