Widen / cloudfront-auth

An AWS CloudFront Lambda@Edge function to authenticate requests using Google Apps, Microsoft, Auth0, OKTA, and GitHub login
ISC License
626 stars 149 forks source link

testing with ngrok #63

Open petersonsbuild opened 4 years ago

petersonsbuild commented 4 years ago

Having an issue with testing locally using ngrok - here is some more info on my setup:

1) the contents of config-test.json:

{
    "port": 8080,
    "auth": "y",
    "lambdaFunction": "LF",
    "aws": {
        "accessKeyId": "AKID", 
        "secretAccessKey": "SAK", 
        "region": "us-east-1"
    }
}

2) Running npm test --distribution test from the project root folder as referenced in the wiki

3) Here is the error (failed to start tunnel) I'm seeing:

root@f4d15df9f78a:/TMO/cloudfront-auth# npm test --distribution test

> cloudfront-auth@1.0.0 test /TMO/cloudfront-auth
> cd tests && npm install && cd .. && node tests/tests.js "test"

npm WARN cloudfront-auth-tests@1.0.0 No description
npm WARN cloudfront-auth-tests@1.0.0 No repository field.

audited 167 packages in 1.379s
found 5 vulnerabilities (1 low, 4 high)
  run `npm audit fix` to fix them, or `npm audit` for details
USERNAME: FyL65V337C
PASSWORD: GWq2e4x0BS
{ Error: failed to start tunnel
    at Request._callback (/TMO/cloudfront-auth/tests/node_modules/ngrok/index.js:192:30)
    at Request.self.callback (/TMO/cloudfront-auth/tests/node_modules/request/request.js:185:22)
    at Request.emit (events.js:198:13)
    at Request.EventEmitter.emit (domain.js:448:20)
    at Request.<anonymous> (/TMO/cloudfront-auth/tests/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:198:13)
    at Request.EventEmitter.emit (domain.js:448:20)
    at IncomingMessage.<anonymous> (/TMO/cloudfront-auth/tests/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:286:20)
    at IncomingMessage.emit (events.js:203:15)
  '0': '<',
  '1': 'H',
  '2': 'T',
  '3': 'M',
  '4': 'L',
  '5': '>',
  '6': '\r',
  '7': '\n',
  '8': '<',
  '9': 'H',
  '10': 'E',
  '11': 'A',
  '12': 'D',
  '13': '>',
  '14': '<',
  '15': 'T',
  '16': 'I',
  '17': 'T',
  '18': 'L',
  '19': 'E',
  '20': '>',
  '21': 'R',
  '22': 'e',
  '23': 'd',
  '24': 'i',
  '25': 'r',
  '26': 'e',
  '27': 'c',
  '28': 't',
  '29': 'i',
  '30': 'o',
  '31': 'n',
  '32': '<',
  '33': '/',
  '34': 'T',
  '35': 'I',
  '36': 'T',
  '37': 'L',
  '38': 'E',
  '39': '>',
  '40': '<',
  '41': '/',
  '42': 'H',
  '43': 'E',
  '44': 'A',
  '45': 'D',
  '46': '>',
  '47': '\r',
  '48': '\n',
  '49': '<',
  '50': 'B',
  '51': 'O',
  '52': 'D',
  '53': 'Y',
  '54': '>',
  '55': '<',
  '56': 'H',
  '57': '1',
  '58': '>',
  '59': 'R',
  '60': 'e',
  '61': 'd',
  '62': 'i',
  '63': 'r',
  '64': 'e',
  '65': 'c',
  '66': 't',
  '67': '<',
  '68': '/',
  '69': 'H',
  '70': '1',
  '71': '>',
  '72': '<',
  '73': '/',
  '74': 'B',
  '75': 'O',
  '76': 'D',
  '77': 'Y',
  '78': '>',
  '79': '\r',
  '80': '\n' }
/TMO/cloudfront-auth/tests/tests.js:93
        exit(1);
        ^

ReferenceError: exit is not defined
    at /TMO/cloudfront-auth/tests/tests.js:93:9
  '57': '1',
  '58': '>',
  '59': 'R',
  '60': 'e',
  '61': 'd',
  '62': 'i',
  '63': 'r',
  '64': 'e',
  '65': 'c',
  '66': 't',
  '67': '<',
  '68': '/',
  '69': 'H',
  '70': '1',
  '71': '>',
  '72': '<',
  '73': '/',
  '74': 'B',
  '75': 'O',
  '76': 'D',
  '77': 'Y',
  '78': '>',
  '79': '\r',
  '80': '\n' }
/TMO/cloudfront-auth/tests/tests.js:93
        exit(1);
        ^

ReferenceError: exit is not defined
    at /TMO/cloudfront-auth/tests/tests.js:93:9
    at /TMO/cloudfront-auth/tests/node_modules/ngrok/index.js:164:11
    at Request._callback (/TMO/cloudfront-auth/tests/node_modules/ngrok/index.js:193:13)
    at Request.self.callback (/TMO/cloudfront-auth/tests/node_modules/request/request.js:185:22)
    at Request.emit (events.js:198:13)
    at Request.EventEmitter.emit (domain.js:448:20)
    at Request.<anonymous> (/TMO/cloudfront-auth/tests/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:198:13)
    at Request.EventEmitter.emit (domain.js:448:20)
    at IncomingMessage.<anonymous> (/TMO/cloudfront-auth/tests/node_modules/request/request.js:1083:12)
npm ERR! Test failed.  See above for more details.

Any ideas on what I could be doing wrong?

Thanks in advance

petersonsbuild commented 4 years ago

It finally dawned on me what is going on - now that I understand, I'm getting this prompt: " Add http://localhost:4040/_callback to your list of redirect URIs. Press enter when finished: "

Does that mean that I need to add this to the list of redirect URIs for the azure application?