You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
36degrees opened this issue
Sep 5, 2019
· 1 comment
· Fixed by #815
Labels
🐛 BugSomething isn't working the way it should (including incorrect wording in documentation)🕔 HoursA well understood issue which we expect to take less than a day to resolve.
Create an app/v6/routes.js file that fails to run correctly (for example, by including an dependency that can't be resolved)
Run the kit
Expected result
The kit should surface the error from the routes file.
Actual result
The kit starts, but the v6 routes file is silently ignored.
This is because we catch all errors when trying to include the v6/routes.js file, in case it doesn't exist. We silently drop those errors, and just proceed without enabling compatibility mode:
// No routes.js in app/v6 so we can continue with useV6 false
}
I think this may be a fairly likely scenario, because when users update the Prototype Kit they overwrite their package.json file, which means any additional dependencies that were installed are lost. They may then try to use the backwards compatibility mode, but it'll fail silently until they resolve their missing dependencies.
The text was updated successfully, but these errors were encountered:
We automatically ‘enable’ compatibility mode if the file app/v6/routes.js exists.
We currently do this by including it within a try/catch block, relying on the empty catch block handling the case where the file does not exist.
However this means that if any exception is encountered whilst requiring that file, we silently fail and do not enable compatibility mode.
This means that if e.g. a user’s v6 routes file includes a dependency which is not installed (which is likely if the user is trying to update their prototype, as doing so nukes any additional dependencies in their package.json file) then this error will not be reported and compatibility mode just won’t work.
Instead, we test for the presence of app/v6/routes.js – if it exists, then we require it. If any exception is encountered in doing so, it’ll be thrown as expected.
Fixes#799
We automatically ‘enable’ compatibility mode if the file app/v6/routes.js exists.
We currently do this by including it within a try/catch block, relying on the empty catch block handling the case where the file does not exist.
However this means that if any exception is encountered whilst requiring that file, we silently fail and do not enable compatibility mode.
This means that if e.g. a user’s v6 routes file includes a dependency which is not installed (which is likely if the user is trying to update their prototype, as doing so nukes any additional dependencies in their package.json file) then this error will not be reported and compatibility mode just won’t work.
Instead, we test for the presence of app/v6/routes.js – if it exists, then we require it. If any exception is encountered in doing so, it’ll be thrown as expected.
Fixes#799
🐛 BugSomething isn't working the way it should (including incorrect wording in documentation)🕔 HoursA well understood issue which we expect to take less than a day to resolve.
Steps to reproduce:
app/v6/routes.js
file that fails to run correctly (for example, by including an dependency that can't be resolved)Expected result
The kit should surface the error from the routes file.
Actual result
The kit starts, but the v6 routes file is silently ignored.
This is because we catch all errors when trying to include the
v6/routes.js
file, in case it doesn't exist. We silently drop those errors, and just proceed without enabling compatibility mode:govuk-prototype-kit/server.js
Lines 34 to 39 in f29ce0d
I think this may be a fairly likely scenario, because when users update the Prototype Kit they overwrite their package.json file, which means any additional dependencies that were installed are lost. They may then try to use the backwards compatibility mode, but it'll fail silently until they resolve their missing dependencies.
The text was updated successfully, but these errors were encountered: