Skip to content

🎥 Make videos programmatically with React

`@remotion/lambda`: Fix EISDIR error when reading the credentials file

Jonny Burgerbbd0256b0e5a
diff --git a/packages/lambda/src/shared/is-likely-to-have-aws-profile.ts b/packages/lambda/src/shared/is-likely-to-have-aws-profile.ts
index d3f81244b2..68bed5742f 100644
--- a/packages/lambda/src/shared/is-likely-to-have-aws-profile.ts
+++ b/packages/lambda/src/shared/is-likely-to-have-aws-profile.ts
@@ -1,4 +1,4 @@
-import {existsSync, readFileSync} from 'fs';
+import {readFileSync} from 'fs';
import {homedir} from 'os';
import {join, sep} from 'path';
@@ -38,10 +38,11 @@ const pathOfCredentialsFile = () => {
export const isLikelyToHaveAwsProfile = (): boolean => {
const credentialsFile = pathOfCredentialsFile();
- if (!existsSync(credentialsFile)) {
+
+ try {
+ const content = readFileSync(credentialsFile, 'utf-8');
+ return content.includes('[default]');
+ } catch (err) {
return false;
}
-
- const content = readFileSync(credentialsFile, 'utf-8');
- return content.includes('[default]');
};