camunda / camunda-modeler

An integrated modeling solution for BPMN, DMN and Forms based on bpmn.io.
https://camunda.com/products/modeler
MIT License
1.49k stars 476 forks source link

Check in the background if the deployment server is reachable #1444

Closed barmac closed 4 years ago

barmac commented 5 years ago

Is your feature request related to a problem? Please describe.

It might be useful to early detect a typo in the endpoint url or a disabled Camunda server.

Describe the solution you'd like

Check in background if the server is reachable. If it's not, display a hint and block the deployment action.

Describe alternatives you've considered

Still allow to deploy and then display the error, as it's implemented right now.

Additional context

Mock up: https://docs.google.com/presentation/d/136nEfebFSh-JfBq4_PfFTzzF7BnKcTysvOgcu8ppx2A/edit#slide=id.g5db3e0a2d5_0_16

Child of https://github.com/camunda/camunda-modeler/issues/1439

barmac commented 5 years ago

Ideas:

Error messages:

  getNetworkErrorMessage(error) {
    switch (error.code) {
    case 'ETIMEDOUT':
    case 'ECONNRESET':
    case 'ECONNREFUSED':
    case 'ENOTFOUND':
      return 'Could not connect to the server. Did you run the engine?';
    }
  }

  getStatusCodeErrorMessage(error) {
    switch (error.status) {
    case 401:
      return 'Connection is unauthorized. Please use valid credentials.';
    case 403:
      return 'Connection is not permitted for your credentials. Please check your credentials.';
    case 404:
      return 'Cannot connect to Camunda. Please check the endpoint URL.';
    case 500:
      return 'Camunda is reporting an unknown error. Please check the server status.';
    case 503:
      return 'Camunda is currently unavailable. Please try again later.';
    }
  }
volkergersabeck commented 5 years ago

Proposal for better error messages. Please check if they fit into the message box. Maybe we need to shorten some of them a bit.

  getNetworkErrorMessage(error) {
    switch (error.code) {
    case 'ETIMEDOUT':
    case 'ECONNRESET':
    case 'ECONNREFUSED':
    case 'ENOTFOUND':
      return 'Could not establish a network connection. Most likely your machine is not online right now.';
    }
  }

  getStatusCodeErrorMessage(error) {
    switch (error.status) {
    case 401:
      return 'Authentication failed. Please check your credentials.';
    case 403:
      return 'This user is not permitted to deploy. Please use different credentials or get this user enabled to deploy.';
    case 404:
      return 'Could not find the Camunda endpoint. Please check the URL and make sure Camunda is running.';
    case 500:
      return 'Camunda is reporting an error. Please check the server status.';
    case 503:
      return 'Camunda is reporting an error. Please check the server status.';
    }
  }
barmac commented 4 years ago

Cool! Thanks for your input. As soon as I have it I'll share the results.

nikku commented 4 years ago

Not sure about this one:

There can be several reasons for it, the most prominent being that Camunda is not up (started) at the target location. Network error, if we can distinguish it, is probably the less frequent issue, especially as default is the localhost setup.

barmac commented 4 years ago

That's true. Usually, with the default value for REST endpoint, we can expect the check to fail because of closed port 8080. The Internet connection problem will occur only for advanced users who want to access a remote Camunda instance, i.e. not using the typical http://localhost:8080 URL. Unfortunately, the error thrown in both cases is the same TypeError and it seems we can't distinguish them within the context of client plugin.

nikku commented 4 years ago

Unfortunately, the error thrown in both cases is the same TypeError and it seems we can't distinguish them within the context of client plugin.

This is understandable from the networking perspective. In this case, please assume Camunda is not up ("not reachable") rather than the user being not connected to the internet.

barmac commented 4 years ago

I managed to distinguish these two types of fetch failures, so the problem of no internet connection/Camunda not running is solved.

barmac commented 4 years ago

Will be closed via https://github.com/camunda/camunda-modeler/pull/1491

barmac commented 4 years ago

Closed via https://github.com/camunda/camunda-modeler/pull/1491