Skip to content

Commit 5dd300d

Browse files
authored
fix: address "coming soon" 404 cache hit problem (#4136)
Fixes: nodejs/build#2751 This is entirely untested (and I'm editing this in my browser too) but this might be a way of addressing the problem. I'm not super happy about exposing this address but it exists and shouldn't suffer from the hard-cache problem that seems to be causing nodejs/build#2751; it'll give accurate results wrt what's actually available on the server, not just what the edge cache has.
1 parent 23f0337 commit 5dd300d

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

scripts/release-post.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ function findAuthorLogin (version, section) {
151151
}
152152

153153
function urlOrComingSoon (binary) {
154-
return sendRequest({ url: binary.url, method: 'HEAD' }).then(
154+
const url = binary.url.replace('nodejs.org', 'direct.nodejs.org')
155+
return sendRequest({ url: url, method: 'HEAD' }).then(
155156
() => `${binary.title}: ${binary.url}`,
156157
() => {
157158
console.log(`\x1B[32m "${binary.title}" is Coming soon...\x1B[39m`)

tests/scripts/release-post.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ test('verifyDownloads(<version>)', (t) => {
4545
})
4646

4747
t.test('resolves to "<binary title>: url" when HEAD request succeed', (t) => {
48-
const nodejsorg = nock('https://nodejs.org')
48+
const nodejsorg = nock('https://direct.nodejs.org')
4949
.head('/dist/v4.1.1/node-v4.1.1.tar.gz')
5050
.reply(200, 'OK')
5151

@@ -60,7 +60,7 @@ test('verifyDownloads(<version>)', (t) => {
6060
})
6161

6262
t.test('resolves to "<binary title>: *Coming soon*" when HEAD request fails', (t) => {
63-
const nodejsorg = nock('https://nodejs.org')
63+
const nodejsorg = nock('https://direct.nodejs.org')
6464
.head('/dist/v4.1.1/node-v4.1.1-linux-armv6l.tar.gz')
6565
.reply(404, 'Not found')
6666

0 commit comments

Comments
 (0)