Skip to content

Unable to connect to intuit oauth platform #108

@ghost

Description

I am working with an AWS Lambda that connects to the QBO API.
Here is a gist of the oauth service I wrote >>

intuit-oauth version: 3.0.2
Node.js version 12

To get the OAuth started I get a fresh refresh token from the QBO playground and store that in a json file. After that it keeps getting renewed. I don't think the refresh token is the problem since it works fine locally and I can see it in the log output.

When I run test locally it works perfectly every time, but only once after I deploy it to AWS.
After the one success and then waiting around 15 minutes to run a test on AWS Lambda I get this error:

PopsicleError: Unable to connect to "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer"
    at Request.error (/var/task/node_modules/intuit-oauth/node_modules/popsicle/dist/request.js:41:16)
    at ClientRequest.<anonymous> (/var/task/node_modules/intuit-oauth/node_modules/popsicle/dist/index.js:131:39)
    at ClientRequest.emit (events.js:326:22)
    at ClientRequest.EventEmitter.emit (domain.js:483:12)
    at TLSSocket.socketErrorListener (_http_client.js:427:9)
    at TLSSocket.emit (events.js:314:20)
    at TLSSocket.EventEmitter.emit (domain.js:483:12)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  cause: Error: connect ETIMEDOUT 54.148.164.32:443
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16) {
    errno: 'ETIMEDOUT',
    code: 'ETIMEDOUT',
    syscall: 'connect',
    address: '54.148.164.32',
    port: 443
  },
  code: 'EUNAVAILABLE',
  popsicle: Request {
    Url: Url {
      protocol: 'https:',
      slashes: true,
      auth: null,
      host: 'oauth.platform.intuit.com',
      port: null,
      hostname: 'oauth.platform.intuit.com',
      hash: null,
      search: null,
      query: [Object: null prototype] {},
      pathname: '/oauth2/v1/tokens/bearer',
      path: '/oauth2/v1/tokens/bearer',
      href: 'https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer'
    },
    rawHeaders: [
      'Authorization',
      'Basic QUJJd1JpUHdLVlFJcmhiUzJ6bjNvOXNWS2lHTHFuRk0yT2d4bHhXRlpHRWJ6Z1kyNlM6N2RsdUVIN1hKNE5Rb1JHbG1qWTFmZ0VvTGt4ZjdreHM1WjNVdmcxVA==',
      'Content-Type',
      'application/x-www-form-urlencoded',
      'Accept',
      'application/json',
      'User-Agent',
      'Intuit-OAuthClient-JS_3.0.2_Linux_4.14.209-112.339.amzn2.x86_64_linux',
      'Content-Length',
      '89',
      'Accept-Encoding',
      'gzip,deflate'
    ],
    middleware: [ [Function], [Function] ],
    opened: true,
    aborted: false,
    uploaded: 1,
    downloaded: 0,
    timeout: 0,
    method: 'POST',
    body: 'grant_type=refresh_token&refresh_token=AB11620585757X1ISX92Nj7a5o2kHSwY2nO7cKmcJYvcGND8Qu',
    events: [Object: null prototype] { abort: [Array] },
    transport: { use: [Array], abort: [Function: abort], open: [Function: open] },
    _promise: Promise { <rejected> [Circular] },
    _raw: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: null,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [TLSSocket],
      connection: [TLSSocket],
      _header: 'POST /oauth2/v1/tokens/bearer HTTP/1.1\r\n' +
        'Authorization: Basic QUJJd1JpUHdLVlFJcmhiUzJ6bjNvOXNWS2lHTHFuRk0yT2d4bHhXRlpHRWJ6Z1kyNlM6N2RsdUVIN1hKNE5Rb1JHbG1qWTFmZ0VvTGt4ZjdreHM1WjNVdmcxVA==\r\n' +
        'Content-Type: application/x-www-form-urlencoded\r\n' +
        'Accept: application/json\r\n' +
        'User-Agent: Intuit-OAuthClient-JS_3.0.2_Linux_4.14.209-112.339.amzn2.x86_64_linux\r\n' +
        'Content-Length: 89\r\n' +
        'Accept-Encoding: gzip,deflate\r\n' +
        'Host: oauth.platform.intuit.com\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'POST',
      insecureHTTPParser: undefined,
      path: '/oauth2/v1/tokens/bearer',
      _ended: false,
      res: null,
      aborted: true,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'oauth.platform.intuit.com',
      protocol: 'https:',
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    },
    uploadLength: 89,
    uploadedBytes: 89
  },
  error: 'Unable to connect to "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer"',
  authResponse: AuthResponse {
    token: Token {
      realmId: '',
      token_type: '',
      access_token: '',
      refresh_token: '',
      expires_in: 0,
      x_refresh_token_expires_in: 0,
      id_token: '',
      latency: 60000,
      createdAt: 1611935355498
    },
    response: '',
    body: '',
    json: null,
    intuit_tid: ''
  },
  intuit_tid: '',
  originalMessage: 'Unable to connect to "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer"',
  error_description: ''
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions