claudia icon indicating copy to clipboard operation
claudia copied to clipboard

claudia create should fail gracefully on network error

Open ceefour opened this issue 5 years ago • 0 comments

  • Expected behaviour: claudia create fails gracefully, either

  • 1st time, claudia.json is created so it can resume operation later

  • or 2nd time, when role already exists, claudia create can resume 1st failed operation

  • What actually happens:

1st time: claudia create half-fails, but did not create claudia.json file

>npx claudia create --region us-east-1 --handler lambda.handler
npx: installed 1 in 8.059s
Path must be a string. Received undefined
C:\Users\ceefour\git\heartenly-profile\node_modules\claudia\bin\cmd.js
packaging files npm install -q --no-audit --production
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

creating Lambda lambda.setupRequestListeners
{ UnknownEndpoint: Inaccessible host: `lambda.us-east-1.amazonaws.com'. This service may not be available in the `us-east-1' region.
    at Request.ENOTFOUND_ERROR (C:\Users\ceefour\git\heartenly-profile\node_modules\aws-sdk\lib\event_listeners.js:481:46)
    at Request.callListeners (C:\Users\ceefour\git\heartenly-profile\node_modules\aws-sdk\lib\sequential_executor.js:109:20)
    at Request.emit (C:\Users\ceefour\git\heartenly-profile\node_modules\aws-sdk\lib\sequential_executor.js:81:10)
    at Request.emit (C:\Users\ceefour\git\heartenly-profile\node_modules\aws-sdk\lib\request.js:683:14)
    at ClientRequest.error (C:\Users\ceefour\git\heartenly-profile\node_modules\aws-sdk\lib\event_listeners.js:320:22)
    at ClientRequest.<anonymous> (C:\Users\ceefour\git\heartenly-profile\node_modules\aws-sdk\lib\http\node.js:89:19)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at TLSSocket.socketErrorListener (_http_client.js:387:9)
    at emitOne (events.js:116:13)
  message: 'Inaccessible host: `lambda.us-east-1.amazonaws.com\'. This service may not be available in the `us-east-1\' region.',
  code: 'UnknownEndpoint',
  region: 'us-east-1',
  hostname: 'lambda.us-east-1.amazonaws.com',
  retryable: true,
  originalError:
   { Error: getaddrinfo ENOTFOUND lambda.us-east-1.amazonaws.com lambda.us-east-1.amazonaws.com:443
    at errnoException (dns.js:50:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
     message: 'getaddrinfo ENOTFOUND lambda.us-east-1.amazonaws.com lambda.us-east-1.amazonaws.com:443',
     code: 'NetworkingError',
     errno: 'ENOTFOUND',
     syscall: 'getaddrinfo',
     hostname: 'lambda.us-east-1.amazonaws.com',
     host: 'lambda.us-east-1.amazonaws.com',
     port: 443,
     region: 'us-east-1',
     retryable: true,
     time: 2018-09-23T13:53:51.874Z },
  time: 2018-09-23T13:53:51.874Z }

2nd time: claudia create fails because role already exists. At this point it's not possible to do anything without manual intervention (deleting the role from AWS manually? or manually creating claudia.json?)

>npx claudia create --region us-east-1 --handler lambda.handler
npx: installed 1 in 3.61s
Path must be a string. Received undefined
C:\Users\ceefour\git\heartenly-profile\node_modules\claudia\bin\cmd.js
packaging files npm install -q --no-audit --production
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

initialising IAM role   iam.createRole  RoleName=heartenly-profile-executor
{ EntityAlreadyExists: Role with name heartenly-profile-executor already exists.
    at Request.extractError (C:\Users\ceefour\git\heartenly-profile\node_modules\aws-sdk\lib\protocol\query.js:47:29)
    at Request.callListeners (C:\Users\ceefour\git\heartenly-profile\node_modules\aws-sdk\lib\sequential_executor.js:109:20)
    at Request.emit (C:\Users\ceefour\git\heartenly-profile\node_modules\aws-sdk\lib\sequential_executor.js:81:10)
    at Request.emit (C:\Users\ceefour\git\heartenly-profile\node_modules\aws-sdk\lib\request.js:683:14)
    at Request.transition (C:\Users\ceefour\git\heartenly-profile\node_modules\aws-sdk\lib\request.js:22:10)
    at AcceptorStateMachine.runTo (C:\Users\ceefour\git\heartenly-profile\node_modules\aws-sdk\lib\state_machine.js:14:12)
    at C:\Users\ceefour\git\heartenly-profile\node_modules\aws-sdk\lib\state_machine.js:26:10
    at Request.<anonymous> (C:\Users\ceefour\git\heartenly-profile\node_modules\aws-sdk\lib\request.js:38:9)
    at Request.<anonymous> (C:\Users\ceefour\git\heartenly-profile\node_modules\aws-sdk\lib\request.js:685:12)
    at Request.callListeners (C:\Users\ceefour\git\heartenly-profile\node_modules\aws-sdk\lib\sequential_executor.js:119:18)
  message: 'Role with name heartenly-profile-executor already exists.',
  code: 'EntityAlreadyExists',
  time: 2018-09-23T14:42:08.111Z,
  requestId: 'd8fb5ee6-bf3e-11e8-a7ab-bb3f06326a19',
  statusCode: 409,
  retryable: false,
  retryDelay: 13.245270024648391 }
  • Link to a minimal, executable project that demonstrates the problem:

any project, just need to reproduce or simulate the network issue

  • Steps to install the project:

any project

  • Steps to reproduce the problem:
  1. new project, make claudia create half-fail
  2. observe that claudia.json is not created

ceefour avatar Sep 23 '18 14:09 ceefour