Skip to content

Commit 87c52bb

Browse files
authored
fix(credentials) better handling if credential providers fail (#22)
1 parent dcfa17c commit 87c52bb

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ Release process:
149149

150150
- fix: relax validation to not validate some generic metadata fields. Encountered
151151
while trying to use Lambda [#21](https://github.com/Kong/lua-resty-aws/pull/21)
152+
- fix: better error handling when credential providers fail to load
153+
[#22](https://github.com/Kong/lua-resty-aws/pull/22)
152154

153155
### 0.5.1 (01-Jun-2022)
154156

src/resty/aws/init.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,14 @@ function AWS:new(config)
480480
return creds, err
481481
end
482482
else
483-
-- not implemented yet
484-
aws_instance[class_name] = function(self, opts)
485-
error(("'%s' hasn't been implemented yet"):format(class_name), 2)
483+
if cred_class:find("module 'resty.aws.credentials." .. class_name .. "' not found", 1, true) then
484+
-- not implemented yet
485+
aws_instance[class_name] = function(self, opts)
486+
error(("'%s' hasn't been implemented yet"):format(class_name), 2)
487+
end
488+
else
489+
-- some other error, bail out
490+
error(cred_class)
486491
end
487492
end
488493
end

0 commit comments

Comments
 (0)