smswithoutborders / SMSwithoutborders-BE

Here is the cloud API and User management services. It is directly configurable with MySQL databases for managing users. Also provides out of the box integrations of Google OAuth end-points and Account authentication
GNU General Public License v3.0
12 stars 3 forks source link

Cannot store tokens #11

Closed nSedrickm closed 3 years ago

nSedrickm commented 3 years ago

POST ​/users​/tokens breaks

API console error logs :

TypeError: Cannot read property 'findAll' of undefined
[0]     at /home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/controllers/googleAuth.js:75:35
[0]     at Layer.handle [as handle_request] (/home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/express/lib/router/layer.js:95:5)
[0]     at next (/home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/express/lib/router/route.js:137:13)
[0]     at Route.dispatch (/home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/express/lib/router/route.js:112:3)
[0]     at Layer.handle [as handle_request] (/home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/express/lib/router/layer.js:95:5)
[0]     at /home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/express/lib/router/index.js:281:22
[0]     at Function.process_params (/home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/express/lib/router/index.js:335:12)
[0]     at next (/home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/express/lib/router/index.js:275:10)
[0]     at logger (/home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/morgan/index.js:144:5)
[0]     at Layer.handle [as handle_request] (/home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/express/lib/router/layer.js:95:5)
[0] Error: socket hang up
[0]     at connResetException (internal/errors.js:609:14)
[0]     at Socket.socketOnEnd (_http_client.js:458:23)
[0]     at Socket.emit (events.js:326:22)
[0]     at endReadableNT (_stream_readable.js:1241:12)
[0]     at processTicksAndRejections (internal/process/task_queues.js:84:21) {
[0]   code: 'ECONNRESET',
[0]   config: {
[0]     url: 'http://localhost:9000/oauth2/google/Tokens/',
[0]     method: 'post',
[0]     data: '{"auth_key":"5fd834d6-7466-4541-af46-350467f19805","provider":"google","platform":"gmail","origin":"http://localhost:18000"}',
[0]     headers: {
[0]       Accept: 'application/json, text/plain, */*',
[0]       'Content-Type': 'application/json;charset=utf-8',
[0]       'User-Agent': 'axios/0.21.1',
[0]       'Content-Length': 124
[0]     },
[0]     transformRequest: [ [Function: transformRequest] ],
[0]     transformResponse: [ [Function: transformResponse] ],
[0]     timeout: 0,
[0]     adapter: [Function: httpAdapter],
[0]     xsrfCookieName: 'XSRF-TOKEN',
[0]     xsrfHeaderName: 'X-XSRF-TOKEN',
[0]     maxContentLength: -1,
[0]     maxBodyLength: -1,
[0]     validateStatus: [Function: validateStatus]
[0]   },
[0]   request: Writable {
[0]     _writableState: WritableState {
[0]       objectMode: false,
[0]       highWaterMark: 16384,
[0]       finalCalled: false,
[0]       needDrain: false,
[0]       ending: false,
[0]       ended: false,
[0]       finished: false,
[0]       destroyed: false,
[0]       decodeStrings: true,
[0]       defaultEncoding: 'utf8',
[0]       length: 0,
[0]       writing: false,
[0]       corked: 0,
[0]       sync: true,
[0]       bufferProcessing: false,
[0]       onwrite: [Function: bound onwrite],
[0]       writecb: null,
[0]       writelen: 0,
[0]       afterWriteTickInfo: null,
[0]       bufferedRequest: null,
[0]       lastBufferedRequest: null,
[0]       pendingcb: 0,
[0]       prefinished: false,
[0]       errorEmitted: false,
[0]       emitClose: true,
[0]       autoDestroy: false,
[0]       bufferedRequestCount: 0,
[0]       corkedRequestsFree: [Object]
[0]     },
[0]     writable: true,
[0]     _events: [Object: null prototype] {
[0]       response: [Function: handleResponse],
[0]       error: [Function: handleRequestError]
[0]     },
[0]     _eventsCount: 2,
[0]     _maxListeners: undefined,
[0]     _options: {
[0]       maxRedirects: 21,
[0]       maxBodyLength: 10485760,
[0]       protocol: 'http:',
[0]       path: '/oauth2/google/Tokens/',
[0]       method: 'POST',
[0]       headers: [Object],
[0]       agent: undefined,
[0]       agents: [Object],
[0]       auth: undefined,
[0]       hostname: 'localhost',
[0]       port: '9000',
[0]       nativeProtocols: [Object],
[0]       pathname: '/oauth2/google/Tokens/'
[0]     },
[0]     _ended: true,
[0]     _ending: true,
[0]     _redirectCount: 0,
[0]     _redirects: [],
[0]     _requestBodyLength: 124,
[0]     _requestBodyBuffers: [ [Object] ],
[0]     _onNativeResponse: [Function],
[0]     _currentRequest: ClientRequest {
[0]       _events: [Object: null prototype],
[0]       _eventsCount: 7,
[0]       _maxListeners: undefined,
[0]       outputData: [],
[0]       outputSize: 0,
[0]       writable: true,
[0]       _last: true,
[0]       chunkedEncoding: false,
[0]       shouldKeepAlive: false,
[0]       _defaultKeepAlive: true,
[0]       useChunkedEncodingByDefault: true,
[0]       sendDate: false,
[0]       _removedConnection: false,
[0]       _removedContLen: false,
[0]       _removedTE: false,
[0]       _contentLength: null,
[0]       _hasBody: true,
[0]       _trailer: '',
[0]       finished: true,
[0]       _headerSent: true,
[0]       socket: [Socket],
[0]       connection: [Socket],
[0]       _header: 'POST /oauth2/google/Tokens/ HTTP/1.1\r\n' +
[0]         'Accept: application/json, text/plain, */*\r\n' +
[0]         'Content-Type: application/json;charset=utf-8\r\n' +
[0]         'User-Agent: axios/0.21.1\r\n' +
[0]         'Content-Length: 124\r\n' +
[0]         'Host: localhost:9000\r\n' +
[0]         'Connection: close\r\n' +
[0]         '\r\n',
[0]       _keepAliveTimeout: 0,
[0]       _onPendingData: [Function: noopPendingOutput],
[0]       agent: [Agent],
[0]       socketPath: undefined,
[0]       method: 'POST',
[0]       insecureHTTPParser: undefined,
[0]       path: '/oauth2/google/Tokens/',
[0]       _ended: false,
[0]       res: null,
[0]       aborted: false,
[0]       timeoutCb: null,
[0]       upgradeOrConnect: false,
[0]       parser: null,
[0]       maxHeadersCount: null,
[0]       reusedSocket: false,
[0]       host: 'localhost',
[0]       protocol: 'http:',
[0]       _redirectable: [Circular],
[0]       [Symbol(kCapture)]: false,
[0]       [Symbol(kNeedDrain)]: false,
[0]       [Symbol(corked)]: 0,
[0]       [Symbol(kOutHeaders)]: [Object: null prototype]
[0]     },
[0]     _currentUrl: 'http://localhost:9000/oauth2/google/Tokens/',
[0]     [Symbol(kCapture)]: false
[0]   },
[0]   response: undefined,
[0]   isAxiosError: true,
[0]   toJSON: [Function: toJSON]
[0] }
[0] Valid IP:  true
[0] ipv4
[0] ::ffff:127.0.0.1
[0] Error: socket hang up
[0]     at connResetException (internal/errors.js:609:14)
[0]     at Socket.socketOnEnd (_http_client.js:458:23)
[0]     at Socket.emit (events.js:326:22)
[0]     at endReadableNT (_stream_readable.js:1241:12)
[0]     at processTicksAndRejections (internal/process/task_queues.js:84:21) {
[0]   code: 'ECONNRESET',
[0]   config: {
[0]     url: 'http://localhost:9000/oauth2/google/Tokens/',
[0]     method: 'post',
[0]     data: '{"auth_key":"5fd834d6-7466-4541-af46-350467f19805","provider":"google","platform":"gmail","origin":"http://localhost:18000"}',
[0]     headers: {
[0]       Accept: 'application/json, text/plain, */*',
[0]       'Content-Type': 'application/json;charset=utf-8',
[0]       'User-Agent': 'axios/0.21.1',
[0]       'Content-Length': 124
[0]     },
[0]     transformRequest: [ [Function: transformRequest] ],
[0]     transformResponse: [ [Function: transformResponse] ],
[0]     timeout: 0,
[0]     adapter: [Function: httpAdapter],
[0]     xsrfCookieName: 'XSRF-TOKEN',
[0]     xsrfHeaderName: 'X-XSRF-TOKEN',
[0]     maxContentLength: -1,
[0]     maxBodyLength: -1,
[0]     validateStatus: [Function: validateStatus]
[0]   },
[0]   request: Writable {
[0]     _writableState: WritableState {
[0]       objectMode: false,
[0]       highWaterMark: 16384,
[0]       finalCalled: false,
[0]       needDrain: false,
[0]       ending: false,
[0]       ended: false,
[0]       finished: false,
[0]       destroyed: false,
[0]       decodeStrings: true,
[0]       defaultEncoding: 'utf8',
[0]       length: 0,
[0]       writing: false,
[0]       corked: 0,
[0]       sync: true,
[0]       bufferProcessing: false,
[0]       onwrite: [Function: bound onwrite],
[0]       writecb: null,
[0]       writelen: 0,
[0]       afterWriteTickInfo: null,
[0]       bufferedRequest: null,
[0]       lastBufferedRequest: null,
[0]       pendingcb: 0,
[0]       prefinished: false,
[0]       errorEmitted: false,
[0]       emitClose: true,
[0]       autoDestroy: false,
[0]       bufferedRequestCount: 0,
[0]       corkedRequestsFree: [Object]
[0]     },
[0]     writable: true,
[0]     _events: [Object: null prototype] {
[0]       response: [Function: handleResponse],
[0]       error: [Function: handleRequestError]
[0]     },
[0]     _eventsCount: 2,
[0]     _maxListeners: undefined,
[0]     _options: {
[0]       maxRedirects: 21,
[0]       maxBodyLength: 10485760,
[0]       protocol: 'http:',
[0]       path: '/oauth2/google/Tokens/',
[0]       method: 'POST',
[0]       headers: [Object],
[0]       agent: undefined,
[0]       agents: [Object],
[0]       auth: undefined,
[0]       hostname: 'localhost',
[0]       port: '9000',
[0]       nativeProtocols: [Object],
[0]       pathname: '/oauth2/google/Tokens/'
[0]     },
[0]     _ended: true,
[0]     _ending: true,
[0]     _redirectCount: 0,
[0]     _redirects: [],
[0]     _requestBodyLength: 124,
[0]     _requestBodyBuffers: [ [Object] ],
[0]     _onNativeResponse: [Function],
[0]     _currentRequest: ClientRequest {
[0]       _events: [Object: null prototype],
[0]       _eventsCount: 7,
[0]       _maxListeners: undefined,
[0]       outputData: [],
[0]       outputSize: 0,
[0]       writable: true,
[0]       _last: true,
[0]       chunkedEncoding: false,
[0]       shouldKeepAlive: false,
[0]       _defaultKeepAlive: true,
[0]       useChunkedEncodingByDefault: true,
[0]       sendDate: false,
[0]       _removedConnection: false,
[0]       _removedContLen: false,
[0]       _removedTE: false,
[0]       _contentLength: null,
[0]       _hasBody: true,
[0]       _trailer: '',
[0]       finished: true,
[0]       _headerSent: true,
[0]       socket: [Socket],
[0]       connection: [Socket],
[0]       _header: 'POST /oauth2/google/Tokens/ HTTP/1.1\r\n' +
[0]         'Accept: application/json, text/plain, */*\r\n' +
[0]         'Content-Type: application/json;charset=utf-8\r\n' +
[0]         'User-Agent: axios/0.21.1\r\n' +
[0]         'Content-Length: 124\r\n' +
[0]         'Host: localhost:9000\r\n' +
[0]         'Connection: close\r\n' +
[0]         '\r\n',
[0]       _keepAliveTimeout: 0,
[0]       _onPendingData: [Function: noopPendingOutput],
[0]       agent: [Agent],
[0]       socketPath: undefined,
[0]       method: 'POST',
[0]       insecureHTTPParser: undefined,
[0]       path: '/oauth2/google/Tokens/',
[0]       _ended: false,
[0]       res: null,
[0]       aborted: false,
[0]       timeoutCb: null,
[0]       upgradeOrConnect: false,
[0]       parser: null,
[0]       maxHeadersCount: null,
[0]       reusedSocket: false,
[0]       host: 'localhost',
[0]       protocol: 'http:',
[0]       _redirectable: [Circular],
[0]       [Symbol(kCapture)]: false,
[0]       [Symbol(kNeedDrain)]: false,
[0]       [Symbol(corked)]: 0,
[0]       [Symbol(kOutHeaders)]: [Object: null prototype]
[0]     },
[0]     _currentUrl: 'http://localhost:9000/oauth2/google/Tokens/',
[0]     [Symbol(kCapture)]: false
[0]   },
[0]   response: undefined,
[0]   isAxiosError: true,
[0]   toJSON: [Function: toJSON]
[0] }
[0] >> OURL: localhost
[0] Valid IP:  true
[0] ipv4
[0] ::ffff:127.0.0.1
[0] TypeError: Cannot read property 'findAll' of undefined
[0]     at /home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/controllers/googleAuth.js:75:35
[0]     at Layer.handle [as handle_request] (/home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/express/lib/router/layer.js:95:5)
[0]     at next (/home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/express/lib/router/route.js:137:13)
[0]     at Route.dispatch (/home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/express/lib/router/route.js:112:3)
[0]     at Layer.handle [as handle_request] (/home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/express/lib/router/layer.js:95:5)
[0]     at /home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/express/lib/router/index.js:281:22
[0]     at Function.process_params (/home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/express/lib/router/index.js:335:12)
[0]     at next (/home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/express/lib/router/index.js:275:10)
[0]     at logger (/home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/morgan/index.js:144:5)
[0]     at Layer.handle [as handle_request] (/home/nsedrickm/Documents/SMSwithoutborders/smswithoutborders_API_services/node_modules/express/lib/router/layer.js:95:5)
[0] Valid IP:  true
[0] ipv4
[0] ::ffff:127.0.0.1
[0] Valid IP:  true
[0] ipv4
[0] ::ffff:127.0.0.1
[0] Valid IP:  true
[0] ipv4
[0] ::ffff:127.0.0.1
[0] Valid IP:  true
[0] ipv4
[0] ::ffff:127.0.0.1
[0] Error: socket hang up
[0]     at connResetException (internal/errors.js:609:14)
[0]     at Socket.socketOnEnd (_http_client.js:458:23)
[0]     at Socket.emit (events.js:326:22)
[0]     at endReadableNT (_stream_readable.js:1241:12)
[0]     at processTicksAndRejections (internal/process/task_queues.js:84:21) {
[0]   code: 'ECONNRESET',
[0]   config: {
[0]     url: 'http://localhost:9000/oauth2/google/Tokens/',
[0]     method: 'post',
[0]     data: '{"auth_key":"5fd834d6-7466-4541-af46-350467f19805","provider":"google","platform":"gmail","origin":"http://localhost:18000"}',
[0]     headers: {
[0]       Accept: 'application/json, text/plain, */*',
[0]       'Content-Type': 'application/json;charset=utf-8',
[0]       'User-Agent': 'axios/0.21.1',
[0]       'Content-Length': 124
[0]     },
[0]     transformRequest: [ [Function: transformRequest] ],
[0]     transformResponse: [ [Function: transformResponse] ],
[0]     timeout: 0,
[0]     adapter: [Function: httpAdapter],
[0]     xsrfCookieName: 'XSRF-TOKEN',
[0]     xsrfHeaderName: 'X-XSRF-TOKEN',
[0]     maxContentLength: -1,
[0]     maxBodyLength: -1,
[0]     validateStatus: [Function: validateStatus]
[0]   },
[0]   request: Writable {
[0]     _writableState: WritableState {
[0]       objectMode: false,
[0]       highWaterMark: 16384,
[0]       finalCalled: false,
[0]       needDrain: false,
[0]       ending: false,
[0]       ended: false,
[0]       finished: false,
[0]       destroyed: false,
[0]       decodeStrings: true,
[0]       defaultEncoding: 'utf8',
[0]       length: 0,
[0]       writing: false,
[0]       corked: 0,
[0]       sync: true,
[0]       bufferProcessing: false,
[0]       onwrite: [Function: bound onwrite],
[0]       writecb: null,
[0]       writelen: 0,
[0]       afterWriteTickInfo: null,
[0]       bufferedRequest: null,
[0]       lastBufferedRequest: null,
[0]       pendingcb: 0,
[0]       prefinished: false,
[0]       errorEmitted: false,
[0]       emitClose: true,
[0]       autoDestroy: false,
[0]       bufferedRequestCount: 0,
[0]       corkedRequestsFree: [Object]
[0]     },
[0]     writable: true,
[0]     _events: [Object: null prototype] {
[0]       response: [Function: handleResponse],
[0]       error: [Function: handleRequestError]
[0]     },
[0]     _eventsCount: 2,
[0]     _maxListeners: undefined,
[0]     _options: {
[0]       maxRedirects: 21,
[0]       maxBodyLength: 10485760,
[0]       protocol: 'http:',
[0]       path: '/oauth2/google/Tokens/',
[0]       method: 'POST',
[0]       headers: [Object],
[0]       agent: undefined,
[0]       agents: [Object],
[0]       auth: undefined,
[0]       hostname: 'localhost',
[0]       port: '9000',
[0]       nativeProtocols: [Object],
[0]       pathname: '/oauth2/google/Tokens/'
[0]     },
[0]     _ended: true,
[0]     _ending: true,
[0]     _redirectCount: 0,
[0]     _redirects: [],
[0]     _requestBodyLength: 124,
[0]     _requestBodyBuffers: [ [Object] ],
[0]     _onNativeResponse: [Function],
[0]     _currentRequest: ClientRequest {
[0]       _events: [Object: null prototype],
[0]       _eventsCount: 7,
[0]       _maxListeners: undefined,
[0]       outputData: [],
[0]       outputSize: 0,
[0]       writable: true,
[0]       _last: true,
[0]       chunkedEncoding: false,
[0]       shouldKeepAlive: false,
[0]       _defaultKeepAlive: true,
[0]       useChunkedEncodingByDefault: true,
[0]       sendDate: false,
[0]       _removedConnection: false,
[0]       _removedContLen: false,
[0]       _removedTE: false,
[0]       _contentLength: null,
[0]       _hasBody: true,
[0]       _trailer: '',
[0]       finished: true,
[0]       _headerSent: true,
[0]       socket: [Socket],
[0]       connection: [Socket],
[0]       _header: 'POST /oauth2/google/Tokens/ HTTP/1.1\r\n' +
[0]         'Accept: application/json, text/plain, */*\r\n' +
[0]         'Content-Type: application/json;charset=utf-8\r\n' +
[0]         'User-Agent: axios/0.21.1\r\n' +
[0]         'Content-Length: 124\r\n' +
[0]         'Host: localhost:9000\r\n' +
[0]         'Connection: close\r\n' +
[0]         '\r\n',
[0]       _keepAliveTimeout: 0,
[0]       _onPendingData: [Function: noopPendingOutput],
[0]       agent: [Agent],
[0]       socketPath: undefined,
[0]       method: 'POST',
[0]       insecureHTTPParser: undefined,
[0]       path: '/oauth2/google/Tokens/',
[0]       _ended: false,
[0]       res: null,
[0]       aborted: false,
[0]       timeoutCb: null,
[0]       upgradeOrConnect: false,
[0]       parser: null,
[0]       maxHeadersCount: null,
[0]       reusedSocket: false,
[0]       host: 'localhost',
[0]       protocol: 'http:',
[0]       _redirectable: [Circular],
[0]       [Symbol(kCapture)]: false,
[0]       [Symbol(kNeedDrain)]: false,
[0]       [Symbol(corked)]: 0,
[0]       [Symbol(kOutHeaders)]: [Object: null prototype]
[0]     },
[0]     _currentUrl: 'http://localhost:9000/oauth2/google/Tokens/',
[0]     [Symbol(kCapture)]: false
[0]   },
[0]   response: undefined,
[0]   isAxiosError: true,
[0]   toJSON: [Function: toJSON]
[0] }
nSedrickm commented 3 years ago

image