Repository: sveltejs/kit
Pull request #8487 (2023-01-12 15:54:13)

fix: check version on node fetch fail
possibly related to #7071
the "check if version updated" logic was only applied to data loading, not loading the node files itself

no test because I don't know how 😄 a good example where unit-testing this would help

### Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
- [x] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
- [x] This message body should clearly illustrate what problems it solves.
- [ ] Ideally, include a test that fails without this PR but passes with it.

### Tests
- [x] Run the tests with `pnpm test` and lint the project with `pnpm lint` and `pnpm check`

### Changesets
- [x] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running `pnpm changeset` and following the prompts. Changesets that add features should be `minor` and those that fix bugs should be `patch`. Please prefix changeset messages with `feat:`, `fix:`, or `chore:`.


changeset-bot[bot]: ###  🦋  Changeset detected

Latest commit: dbb8fe7b216462f23020043dfe394ca635fed197

**The changes in this PR will be included in the next version bump.**

<details><summary>This PR includes changesets to release 1 package</summary>

  | Name          | Type  |
| ------------- | ----- |
| @sveltejs/kit | Patch |

</details>

Not sure what this means? [Click here  to learn what changesets are](https://github.com/changesets/changesets/blob/master/docs/adding-a-changeset.md).

[Click here if you're a maintainer who wants to add another changeset to this PR](https://github.com/sveltejs/kit/new/check-version?filename=.changeset/wicked-clouds-fetch.md&value=---%0A%22%40sveltejs%2Fkit%22%3A%20patch%0A---%0A%0Afix%3A%20check%20version%20on%20node%20fetch%20fail%0A)



Patch:
diff --git a/.changeset/strange-pens-pump.md b/.changeset/strange-pens-pump.md
new file mode 100644
index 000000000..6ed108939
--- /dev/null
+++ b/.changeset/strange-pens-pump.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+fix: check version on node fetch fail
diff --git a/packages/adapter-netlify/package.json b/packages/adapter-netlify/package.json
index 13cd02a73..c6c0c6f64 100644
--- a/packages/adapter-netlify/package.json
+++ b/packages/adapter-netlify/package.json
@@ -44,7 +44,7 @@
 		"@sveltejs/kit": "workspace:^",
 		"@types/node": "^16.18.6",
 		"@types/set-cookie-parser": "^2.4.2",
-		"rimraf": "^3.0.2",
+		"rimraf": "^4.0.0",
 		"rollup": "^3.7.0",
 		"typescript": "^4.9.4",
 		"uvu": "^0.5.6"
diff --git a/packages/adapter-node/package.json b/packages/adapter-node/package.json
index a2297bb30..d6c224db0 100644
--- a/packages/adapter-node/package.json
+++ b/packages/adapter-node/package.json
@@ -36,7 +36,7 @@
 		"@types/node": "^16.18.6",
 		"c8": "^7.12.0",
 		"polka": "^1.0.0-next.22",
-		"rimraf": "^3.0.2",
+		"rimraf": "^4.0.0",
 		"sirv": "^2.0.2",
 		"typescript": "^4.9.4",
 		"uvu": "^0.5.6"
diff --git a/packages/kit/src/runtime/client/client.js b/packages/kit/src/runtime/client/client.js
index ddc3a32c3..a669388e2 100644
--- a/packages/kit/src/runtime/client/client.js
+++ b/packages/kit/src/runtime/client/client.js
@@ -824,6 +824,12 @@ export function create_client({ target, base }) {
 						status = err.status;
 						error = err.body;
 					} else {
+						// Referenced node could have been removed due to redeploy, check
+						const updated = await stores.updated.check();
+						if (updated) {
+							return await native_navigation(url);
+						}
+
 						error = await handle_error(err, { params, url, route: { id: route.id } });
 					}
 
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ff9c56b0d..69d62fe79 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -88,7 +88,7 @@ importers:
       '@types/node': ^16.18.6
       '@types/set-cookie-parser': ^2.4.2
       esbuild: ^0.16.3
-      rimraf: ^3.0.2
+      rimraf: ^4.0.0
       rollup: ^3.7.0
       set-cookie-parser: ^2.5.1
       typescript: ^4.9.4
@@ -105,7 +105,7 @@ importers:
       '@sveltejs/kit': link:../kit
       '@types/node': 16.18.6
       '@types/set-cookie-parser': 2.4.2
-      rimraf: 3.0.2
+      rimraf: 4.0.1
       rollup: 3.7.0
       typescript: 4.9.4
       uvu: 0.5.6
@@ -119,7 +119,7 @@ importers:
       '@types/node': ^16.18.6
       c8: ^7.12.0
       polka: ^1.0.0-next.22
-      rimraf: ^3.0.2
+      rimraf: ^4.0.0
       rollup: ^3.7.0
       sirv: ^2.0.2
       typescript: ^4.9.4
@@ -134,7 +134,7 @@ importers:
       '@types/node': 16.18.6
       c8: 7.12.0
       polka: 1.0.0-next.22
-      rimraf: 3.0.2
+      rimraf: 4.0.1
       sirv: 2.0.2
       typescript: 4.9.4
       uvu: 0.5.6
@@ -338,7 +338,7 @@ importers:
     specifiers:
       '@sveltejs/kit': workspace:^
       cross-env: ^7.0.3
-      rimraf: ^3.0.2
+      rimraf: ^4.0.0
       svelte: ^3.55.1
       svelte-check: ^3.0.2
       typescript: ^4.9.4
@@ -346,7 +346,7 @@ importers:
     devDependencies:
       '@sveltejs/kit': link:../../..
       cross-env: 7.0.3
-      rimraf: 3.0.2
+      rimraf: 4.0.1
       svelte: 3.55.1
       svelte-check: 3.0.2_svelte@3.55.1
       typescript: 4.9.4
@@ -356,7 +356,6 @@ importers:
     specifiers:
       '@sveltejs/kit': workspace:^
       cross-env: ^7.0.3
-      rimraf: ^3.0.2
       svelte: ^3.55.1
       svelte-check: ^3.0.2
       typescript: ^4.9.4
@@ -364,7 +363,6 @@ importers:
     devDependencies:
       '@sveltejs/kit': link:../../..
       cross-env: 7.0.3
-      rimraf: 3.0.2
       svelte: 3.55.1
       svelte-check: 3.0.2_svelte@3.55.1
       typescript: 4.9.4
@@ -408,7 +406,7 @@ importers:
     specifiers:
       '@sveltejs/kit': workspace:^
       cross-env: ^7.0.3
-      rimraf: ^3.0.2
+      rimraf: ^4.0.0
       svelte: ^3.55.1
       svelte-check: ^3.0.2
       typescript: ^4.9.4
@@ -416,7 +414,7 @@ importers:
     devDependencies:
       '@sveltejs/kit': link:../../..
       cross-env: 7.0.3
-      rimraf: 3.0.2
+      rimraf: 4.0.1
       svelte: 3.55.1
       svelte-check: 3.0.2_svelte@3.55.1
       typescript: 4.9.4
@@ -3736,6 +3734,12 @@ packages:
     dependencies:
       glob: 7.2.3
 
+  /rimraf/4.0.1:
+    resolution: {integrity: sha512-qwvb/Wzf8XJxdv8InnDtmijfbIk6gk576swPeogHbUh7AT4ezF42lvhXUdbIzMYrO4HbaXi1rYGhKTDyPF1AJw==}
+    engines: {node: '>=14'}
+    hasBin: true
+    dev: true
+
   /rollup-pluginutils/2.8.2:
     resolution: {integrity: sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==}
     dependencies:


Test patch:
diff --git a/packages/kit/test/apps/basics/package.json b/packages/kit/test/apps/basics/package.json
index 3c1ac04cd..6257ff4b4 100644
--- a/packages/kit/test/apps/basics/package.json
+++ b/packages/kit/test/apps/basics/package.json
@@ -14,7 +14,7 @@
 	"devDependencies": {
 		"@sveltejs/kit": "workspace:^",
 		"cross-env": "^7.0.3",
-		"rimraf": "^3.0.2",
+		"rimraf": "^4.0.0",
 		"svelte": "^3.55.1",
 		"svelte-check": "^3.0.2",
 		"typescript": "^4.9.4",
diff --git a/packages/kit/test/apps/dev-only/package.json b/packages/kit/test/apps/dev-only/package.json
index b4e3669c9..b5e510b23 100644
--- a/packages/kit/test/apps/dev-only/package.json
+++ b/packages/kit/test/apps/dev-only/package.json
@@ -12,7 +12,6 @@
 	"devDependencies": {
 		"@sveltejs/kit": "workspace:^",
 		"cross-env": "^7.0.3",
-		"rimraf": "^3.0.2",
 		"svelte": "^3.55.1",
 		"svelte-check": "^3.0.2",
 		"typescript": "^4.9.4",
diff --git a/packages/kit/test/apps/writes/package.json b/packages/kit/test/apps/writes/package.json
index 77c09f269..a4879d8c8 100644
--- a/packages/kit/test/apps/writes/package.json
+++ b/packages/kit/test/apps/writes/package.json
@@ -14,7 +14,7 @@
 	"devDependencies": {
 		"@sveltejs/kit": "workspace:^",
 		"cross-env": "^7.0.3",
-		"rimraf": "^3.0.2",
+		"rimraf": "^4.0.0",
 		"svelte": "^3.55.1",
 		"svelte-check": "^3.0.2",
 		"typescript": "^4.9.4",