Note: This issue was translated and drafted with the assistance of AI.
Description
Even when the environment variable AWS_S3_FORCE_PATH_STYLE is set to 1 or true, PathStyle remains disabled.
Version
3.0.4
Root Cause
In bin/cdklocal, the shouldForcePathStyle function passes the value of the environment variable to isEnvTrue instead of the variable name.
Since isEnvTrue in src/index.js performs a lookup using the provided argument as a key for process.env, it fails to find the correct value.
bin/cdklocal
const shouldForcePathStyle = () => {
// It currently passes the value (e.g., "1" or "true") instead of the key name
if (isEnvTrue(process.env.AWS_S3_FORCE_PATH_STYLE)) {
return true;
}
const endpointUrl = process.env.AWS_ENDPOINT_URL || "";
try {
return new URL(endpointUrl).hostname.includes(".sandbox.");
} catch {
return false;
}
};
src/index.js
const isEnvTrue = (envName) => ["1", "true"].includes(process.env[envName]);
Note: This issue was translated and drafted with the assistance of AI.
Description
Even when the environment variable
AWS_S3_FORCE_PATH_STYLEis set to1ortrue, PathStyle remains disabled.Version
3.0.4
Root Cause
In
bin/cdklocal, theshouldForcePathStylefunction passes the value of the environment variable toisEnvTrueinstead of the variable name.Since
isEnvTrueinsrc/index.jsperforms a lookup using the provided argument as a key forprocess.env, it fails to find the correct value.bin/cdklocal
src/index.js