Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
'use strict';

/**
* IMPORTANT: This file is cached, so when you test changes made to this file,
* make sure you delete the .serverless directory, and un-memoize the packaging code.
* For more info search for the "utils/ensure-artifact.js" file in the codebase.
*/

const { wait, MAX_AWS_REQUEST_TRY } = require('../utils');
const { getEnvironment, handlerWrapper } = require('../utils');
const {
Expand Down Expand Up @@ -52,7 +58,10 @@ async function create(event, context) {
return (await iam.send(new ListAttachedRolePoliciesCommand({ RoleName: roleName })))
.AttachedPolicies;
} catch (error) {
if (error.code === 'NoSuchEntity') {
if (
error.code === 'NoSuchEntity' ||
error.message.includes('cannot be found')
) {
// Role doesn't exist yet, create;
await iam.send(
new CreateRoleCommand({
Expand Down