|
|
@ -6,6 +6,7 @@ const minimist = require('minimist') |
|
|
|
const { gray, bold } = require('chalk') |
|
|
|
const bytes = require('bytes') |
|
|
|
const uid = require('uid-promise') |
|
|
|
const retry = require('async-retry') |
|
|
|
const debug = require('debug')('now:aws:deploy') |
|
|
|
|
|
|
|
// ours
|
|
|
@ -162,7 +163,10 @@ const deploy = async ({ config, authConfig, argv: argv_ }) => { |
|
|
|
const stopResourcesSpinner = wait('Creating API resources') |
|
|
|
|
|
|
|
debug('initializing lambda function') |
|
|
|
const λ = await createFunction(lambda, { |
|
|
|
const λ = await retry( |
|
|
|
async bail => { |
|
|
|
try { |
|
|
|
return await createFunction(lambda, { |
|
|
|
Code: { |
|
|
|
ZipFile: zipFile |
|
|
|
}, |
|
|
@ -174,6 +178,21 @@ const deploy = async ({ config, authConfig, argv: argv_ }) => { |
|
|
|
Timeout: 15, |
|
|
|
MemorySize: 512 |
|
|
|
}) |
|
|
|
} catch (err) { |
|
|
|
if ( |
|
|
|
err.retryable || |
|
|
|
// created role is not ready
|
|
|
|
err.code === 'InvalidParameterValueException' |
|
|
|
) { |
|
|
|
debug('retrying creating function (%s)', err.message) |
|
|
|
throw err |
|
|
|
} |
|
|
|
|
|
|
|
bail(err) |
|
|
|
} |
|
|
|
}, |
|
|
|
{ minTimeout: 2500, maxTimeout: 5000 } |
|
|
|
) |
|
|
|
|
|
|
|
debug('initializing api gateway') |
|
|
|
const api = await createAPI(gateway, { |
|
|
|