php-perfect / ddev-intellij-plugin

DDEV Tool Integration for IntelliJ IDEA
https://plugins.jetbrains.com/plugin/18813-ddev-integration
BSD 3-Clause "New" or "Revised" License
109 stars 15 forks source link

IDE error reports nonstop when the DDEV project is stopped #233

Closed kevinquillen closed 1 year ago

kevinquillen commented 1 year ago

Is there an existing issue for this?

Are you sure that this bug is related to this DDEV Integration Plugin?

Enter your error report ID (If available)

No response

Describe the bug

Whenever the DDEV instance is stopped or not running, the IDE will report every so often about an error.

image

Error output stacktrace:

de.php_perfect.intellij.ddev.cmd.CommandFailedException: Command '/opt/homebrew/bin/ddev describe --json-output' returned non zero exit code {exitCode=1, timeout=false, cancelled=false, stdout=, stderr={"level":"fatal","msg":"\u001b[31mFailed to describe project(s): PROJECT_NAME is not a valid project name. Please enter a project name in your configuration that will allow for a valid hostname. See https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_hostnames for valid hostname requirements\u001b[0m","time":"2023-09-25T09:42:08-04:00"}
}
    at de.php_perfect.intellij.ddev.cmd.DdevImpl.execute(DdevImpl.java:73)
    at de.php_perfect.intellij.ddev.cmd.DdevImpl.describe(DdevImpl.java:38)
    at de.php_perfect.intellij.ddev.state.DdevStateManagerImpl.checkDescription(DdevStateManagerImpl.java:155)
    at de.php_perfect.intellij.ddev.state.DdevStateManagerImpl.lambda$updateConfiguration$1(DdevStateManagerImpl.java:67)
    at de.php_perfect.intellij.ddev.state.DdevStateManagerImpl.checkChanged(DdevStateManagerImpl.java:90)
    at de.php_perfect.intellij.ddev.state.DdevStateManagerImpl.updateConfiguration(DdevStateManagerImpl.java:65)
    at de.php_perfect.intellij.ddev.state.StateWatcherImpl.lambda$startWatching$0(StateWatcherImpl.java:33)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
    at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:275)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:833)

This error above also speaks to a failed pre-start hook that I have (that I failed on purpose). Either way the project is halted but the error pop up keeps appearing.

When I clicked "Report" it generated another 97 notifications.

Steps to reproduce

No response

Additional context

No response

nico-loeber commented 1 year ago

Hello @kevinquillen,

The error says:

PROJECT_NAME is not a valid project name. Please enter a project name in your configuration that will allow for a valid hostname. See https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_hostnames for valid hostname requirements

Could you please show your .ddev/config.yml? It looks like you have an invalid ddev configuration, that's why the status check of the plugin is failing.

kevinquillen commented 1 year ago

Yes, understood - but the problem is that it keeps probing the project. At least for me. We are creating a project template for projects (ex cloning GitHub to new repo). It starts with

name: PROJECT_NAME
type: drupal10
docroot: docroot
php_version: "8.1"

It errors with ddev start, because it should (we want people to change PROJECT_NAME obv to what the project will be). But the JetBrains plugin keeps throwing the error which makes it hard when developing around. As such, the notifications keep mounting. In this case I am aware of the problem, but in this scenario it isnt technically a problem.

nico-loeber commented 1 year ago

It is the expected behavior of the plugin to monitor the status of the ddev instance. As the ddev binary throws an error (non zero exit code) this will bubble up and throw an error in the plugin as well.

But you can disable this background check for the "template project" by turning it off in the settings:

image

When creating a new project from this template, the first step should be to make the ddev config valid.

Does this solve your problem? What would you suggest on how to handle the error (non zero exit code) of the ddev binary?

kevinquillen commented 1 year ago

Oh, okay, thanks. I didn't know that setting existed. That should work.