From c4a53d9f32302e675beb73cd71579bcaa484114f Mon Sep 17 00:00:00 2001 From: Daniel Nalborczyk Date: Sat, 3 Sep 2022 12:26:50 -0400 Subject: [PATCH] refactor: unsupported docker runtimes --- src/config/supportedRuntimes.js | 2 ++ src/lambda/handler-runner/HandlerRunner.js | 11 +++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/config/supportedRuntimes.js b/src/config/supportedRuntimes.js index 3bda554af..152243de6 100644 --- a/src/config/supportedRuntimes.js +++ b/src/config/supportedRuntimes.js @@ -45,3 +45,5 @@ export const supportedRuntimes = new Set([ ...supportedPython, ...supportedRuby, ]) + +export const unsupportedDockerRuntimes = new Set(['nodejs14.x', 'python3.9']) diff --git a/src/lambda/handler-runner/HandlerRunner.js b/src/lambda/handler-runner/HandlerRunner.js index 6c4fd5cb2..b938f6a1f 100644 --- a/src/lambda/handler-runner/HandlerRunner.js +++ b/src/lambda/handler-runner/HandlerRunner.js @@ -5,6 +5,7 @@ import { supportedNodejs, supportedPython, supportedRuby, + unsupportedDockerRuntimes, } from '../../config/index.js' export default class HandlerRunner { @@ -29,19 +30,13 @@ export default class HandlerRunner { log.debug(`Loading handler... (${handler})`) if (useDocker) { - // https://github.com/lambci/docker-lambda/issues/329 - if (runtime === 'nodejs14.x') { + if (unsupportedDockerRuntimes.has(runtime)) { log.warning( - '"nodejs14.x" runtime is not supported with docker. See https://github.com/lambci/docker-lambda/issues/329', + `"${runtime}" runtime is not supported with docker. See https://github.com/lambci/docker-lambda`, ) throw new Error('Unsupported runtime') } - if (runtime === 'python3.9') { - log.warning('"python3.9" runtime is not supported with docker.') - throw new Error('Unsupported runtime') - } - const dockerOptions = { host: this.#options.dockerHost, hostServicePath: this.#options.dockerHostServicePath,