Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tunnel not starting #1

Open
alex88 opened this issue Jun 14, 2019 · 1 comment
Open

Tunnel not starting #1

alex88 opened this issue Jun 14, 2019 · 1 comment

Comments

@alex88
Copy link

alex88 commented Jun 14, 2019

I'm trying to use this plugin, I've added it to my config:

custom:
  stage: "${opt:stage, self:provider.stage, 'dev'}"
  production:
    GW_URL: { "Fn::Join" : ["", [ "https://", { "Ref" : "ApiGatewayRestApi" }, ".execute-api.${self:custom.region, ''}.amazonaws.com/${self:custom.stage}" ] ]  }
  dev:
    GW_URL: "http://localhost:3000"
  ngrokTunnel:
    envPath: .env
    tunnels:
      - port: 3000
        envProp: 'API_GATEWAY'

plugins:
  - serverless-ngrok-tunnel
  - serverless-offline

however when I do sls tunnel it just shows Serverless: Starting tunnels... and then it quits.

I've tried to log some values around here:

  runTunnel ({port, envProp, ws, path, ngrokOptions}) {
    try {
      ngrok.connect({
        addr: port,
        proto: 'http',
        region: 'eu',
        ...(ngrokOptions || {})
      }, (err, url) => {
        console.log('callback');
        if (err) {
          this.log(`Unable to create tunnel: ${err.message}`)
        } else {
          this.onConnect(url, envProp, ws, path)
        }
      })

      ngrok.on('disconnect', () => this.onTunnelClose())
      ngrok.on('error', (e) => this.errorHandler(e))
    } catch (e) {
      this.errorHandler(e)
    }
  }

and it calls ngrock.connect but nothing else, the callback nor the catch or the disconnect/error event handlers are called

Node 12.4.0 on OSX 10.14.5

@nenadpnc
Copy link
Collaborator

Put serverless-ngrok-tunnel after serverless-offline in serverless.yml, it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants