From 6aa53d67e29460469e6e94614ba2c7c1039f1375 Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Fri, 22 Sep 2023 15:09:02 +0200 Subject: [PATCH] Pass functions manifest `runtimeVersion` to api when uploading functions (#6020) * fix: when uploading functions, respect runtimeVersion field from functions manifest * chore: styling --- src/utils/deploy/hash-fns.mjs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/utils/deploy/hash-fns.mjs b/src/utils/deploy/hash-fns.mjs index 594eeaca0b3..e2adc66b3f1 100644 --- a/src/utils/deploy/hash-fns.mjs +++ b/src/utils/deploy/hash-fns.mjs @@ -106,20 +106,22 @@ const hashFns = async ( statusCb, tmpDir, }) - const fileObjs = functionZips.map(({ displayName, generator, invocationMode, path: functionPath, runtime }) => ({ - filepath: functionPath, - root: tmpDir, - relname: path.relative(tmpDir, functionPath), - basename: path.basename(functionPath), - extname: path.extname(functionPath), - type: 'file', - assetType: 'function', - normalizedPath: path.basename(functionPath, path.extname(functionPath)), - runtime, - displayName, - generator, - invocationMode, - })) + const fileObjs = functionZips.map( + ({ displayName, generator, invocationMode, path: functionPath, runtime, runtimeVersion }) => ({ + filepath: functionPath, + root: tmpDir, + relname: path.relative(tmpDir, functionPath), + basename: path.basename(functionPath), + extname: path.extname(functionPath), + type: 'file', + assetType: 'function', + normalizedPath: path.basename(functionPath, path.extname(functionPath)), + runtime: runtimeVersion ?? runtime, + displayName, + generator, + invocationMode, + }), + ) const fnConfig = functionZips .filter((func) => Boolean(func.displayName || func.generator)) .reduce(