alphagov / govuk-prototype-kit

Rapidly create HTML prototypes of GOV.UK services
https://prototype-kit.service.gov.uk
MIT License
306 stars 236 forks source link

Plugin page fails after updating to 13.10.0 #2249

Closed nataliecarey closed 1 year ago

nataliecarey commented 1 year ago

Description of the issue

When updating from 13.9.1 to 13.10.0 in the browser the plugin the plugin page fails to load.

The logs say "Failed to load the package cache"

Steps to reproduce the issue

  1. npx govuk-prototype-kit create --version=13.9.1 upgrade-from-13.9.1
  2. cd upgrade-from-13.9.1
  3. npm run dev
  4. Visit Manage prototype
  5. Click Plugins
  6. Click Upgrade next to GOV.UK Prototype Kit

Actual vs expected behaviour

Expected: The upgrade works, then the kit is fully working in the new version.

Actual: The upgrade works, but after the upgrade the kit is unable to load the Plugins page. I haven't tested for further impact.

What's going wrong

It's logging to say Failed to load the package cache - failing to read a file system cache should lead to the cache either being ignored or recreated. Either option fixes this bug, recreating it would be my suggestion.

benwatsonuk commented 1 year ago

I was about to raise the same issue - running the prototype locally is fine but when deploying to Heroku, the application crashes instantly...

2023-07-10T07:40:51.714066+00:00 app[web.1]: const { version: installedVersion } = installed ? packageJson : {} 2023-07-10T07:40:51.714066+00:00 app[web.1]: ^ 2023-07-10T07:40:51.714067+00:00 app[web.1]: 2023-07-10T07:40:51.714072+00:00 app[web.1]: TypeError: Cannot destructure property 'version' of '(intermediate value)(intermediate value)(intermediate value)' as it is undefined. 2023-07-10T07:40:51.714073+00:00 app[web.1]: at refreshPackageInfo (/app/node_modules/govuk-prototype-kit/lib/plugins/packages.js:107:20) 2023-07-10T07:40:51.714073+00:00 app[web.1]: at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 2023-07-10T07:40:51.714074+00:00 app[web.1]: at async Promise.all (index 31) 2023-07-10T07:40:51.714074+00:00 app[web.1]: at async startPackageTracker (/app/node_modules/govuk-prototype-kit/lib/plugins/packages.js:23:3) 2023-07-10T07:40:51.714074+00:00 app[web.1]:

This appears to be linked to the same issue in v13.10.0

BenSurgisonGDS commented 1 year ago

This issue will be fixed with the following PR: Prototype will now start when a plugin is missing from node_modules

To be certain, the same test should be done when the fix above is released.