Skip to content

Commit a735bb3

Browse files
committed
Fix netlify functions configuration
The local `netlify` dev server and documentation expect a top-level configuration block named functions, but the remote netlify builder expects a key under the build block instead. Who knows why.
1 parent 3fa5404 commit a735bb3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

docs/book/functions/handle-version.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ function redirectToDownload(version, file) {
1313
const loc = `https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${version}/${file}`;
1414
return {
1515
statusCode: 302,
16-
headers: {'location': loc},
16+
headers: {'location': loc, 'content-type': 'text/plain'},
17+
body: `Redirecting to ${loc}`,
1718
};
1819
}
1920

@@ -22,7 +23,7 @@ exports.handler = async function(evt, ctx) {
2223
// grab the prefix too to check for coherence
2324
const [prefix, version, os, arch] = evt.path.split("/").slice(-4);
2425
if (prefix !== 'releases' || !version || !os || !arch) {
25-
return notFound({version: version, os: os, arch: arch, prefix: constPrefix, rawPath: evt.path});
26+
return notFound({version: version, os: os, arch: arch, prefix: prefix, rawPath: evt.path});
2627
}
2728

2829
switch(version[0]) {

netlify.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22
base = "docs/book"
33
command = "./install-and-build.sh"
44
publish = "docs/book/book"
5+
functions = "docs/book/functions"
6+
7+
# TODO(directxman12): I don't know why, but this (functions) stanza is in the
8+
# docs and local `netlify dev`, but the above one (under build) is used by the
9+
# online version :-/
510

611
# used to handle the split between v2 and v3+ download links
712
[functions]
13+
# relative to base directory
814
directory = "functions"
915

1016
# Standard Netlify redirects

0 commit comments

Comments
 (0)