Skip to content

Commit 1f39b64

Browse files
authored
Merge pull request #134 from joseph-so/fix_apig_78
fix(apig): porting the serverless fix in https://github.com/serverles…
2 parents bdaab39 + 17cec29 commit 1f39b64

File tree

1 file changed

+10
-1
lines changed
  • lib/plugins/aws/custom-resources/resources/api-gateway-cloud-watch-role

1 file changed

+10
-1
lines changed

lib/plugins/aws/custom-resources/resources/api-gateway-cloud-watch-role/handler.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
'use strict';
22

3+
/**
4+
* IMPORTANT: This file is cached, so when you test changes made to this file,
5+
* make sure you delete the .serverless directory, and un-memoize the packaging code.
6+
* For more info search for the "utils/ensure-artifact.js" file in the codebase.
7+
*/
8+
39
const { wait, MAX_AWS_REQUEST_TRY } = require('../utils');
410
const { getEnvironment, handlerWrapper } = require('../utils');
511
const {
@@ -52,7 +58,10 @@ async function create(event, context) {
5258
return (await iam.send(new ListAttachedRolePoliciesCommand({ RoleName: roleName })))
5359
.AttachedPolicies;
5460
} catch (error) {
55-
if (error.code === 'NoSuchEntity') {
61+
if (
62+
error.code === 'NoSuchEntity' ||
63+
error.message.includes('cannot be found')
64+
) {
5665
// Role doesn't exist yet, create;
5766
await iam.send(
5867
new CreateRoleCommand({

0 commit comments

Comments
 (0)