ddev-intellij-plugin icon indicating copy to clipboard operation
ddev-intellij-plugin copied to clipboard

PHP server has empty server name

Open lpeabody opened this issue 6 months ago • 3 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

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

  • [x] I am sure

Enter your error report ID (If available)

No response

Describe the bug

The DDEV plugin is generating a Server configuration entry that has an empty name. Host and path mappings are correctly set. This is breaking the ability to use Xdebug, and is in itself an invalid Server configuration for PHPStorm (if you try and save the server you get an error saying the name can't be empty).

Steps to reproduce

  1. Configure similarly to provided configuration in this issue.
  2. Run ddev restart until the Server configuration has an empty name, but Host and path mappings are correct.

Additional context

Context: I am trying to configure DDEV to work on Coder environments. Since Coder is itself a proxy, the DDEV router is disabled.

I am using Gateway to connect to PHPStorm Server on Coder environment.

DDEV config:

name: drupal8
type: drupal10
docroot: docroot
php_version: "8.3"
webserver_type: apache-fpm
xdebug_enabled: false
additional_hostnames:
  - '*.drupal8'
additional_fqdns: []
database:
    type: mysql
    version: "8.0"
use_dns_when_possible: true
composer_version: "2"
disable_settings_management: true
web_environment:
    - DRUSH_ALLOW_XDEBUG=1
corepack_enable: false
bind_all_interfaces: true

Custom DDEV Docker Compose configuration:

services:
  web:
    ports:
      - 443:443
      - 80:80
    environment:
      - DRUSH_OPTIONS_URI=127.0.0.1

ddev describe --json-output | jq .raw

{
  "approot": "/home/coder/drupal8",
  "database_type": "mysql",
  "database_version": "8.0",
  "dbimg": "ddev/ddev-dbserver-mysql-8.0:v1.24.7",
  "dbinfo": {
    "database_type": "mysql",
    "database_version": "8.0",
    "dbPort": "3306",
    "dbname": "db",
    "host": "db",
    "password": "db",
    "published_port": 33347,
    "username": "db"
  },
  "docroot": "docroot",
  "fail_on_hook_fail": false,
  "hostname": "drupal8.ddev.site",
  "hostnames": [],
  "httpURLs": [
    "http://127.0.0.1:80"
  ],
  "httpsURLs": null,
  "httpsurl": "https://127.0.0.1:443",
  "httpurl": "http://127.0.0.1:80",
  "mailpit_https_url": "https://drupal8.ddev.site:8026",
  "mailpit_url": "http://drupal8.ddev.site:8025",
  "mutagen_enabled": false,
  "name": "drupal8",
  "nodejs_version": "22",
  "performance_mode": "none",
  "php_version": "8.3",
  "primary_url": "http://127.0.0.1:80",
  "router": "traefik",
  "router_disabled": true,
  "router_http_port": "80",
  "router_https_port": "443",
  "router_status": "stopped",
  "router_status_log": "",
  "services": {
    "db": {
      "exposed_ports": "3306",
      "full_name": "ddev-drupal8-db",
      "host_ports": "33347",
      "host_ports_mapping": [
        {
          "exposed_port": "3306",
          "host_port": "33347"
        }
      ],
      "image": "ddev/ddev-dbserver-mysql-8.0:v1.24.7",
      "short_name": "db",
      "status": "running"
    },
    "web": {
      "exposed_ports": "80,443,8025",
      "full_name": "ddev-drupal8-web",
      "host_http_url": "http://127.0.0.1:80",
      "host_https_url": "https://127.0.0.1:443",
      "host_ports": "80,443,33348,33349,33350",
      "host_ports_mapping": [
        {
          "exposed_port": "80",
          "host_port": "80"
        },
        {
          "exposed_port": "80",
          "host_port": "33350"
        },
        {
          "exposed_port": "443",
          "host_port": "443"
        },
        {
          "exposed_port": "443",
          "host_port": "33349"
        },
        {
          "exposed_port": "8025",
          "host_port": "33348"
        }
      ],
      "image": "ddev/ddev-webserver:v1.24.7",
      "short_name": "web",
      "status": "running"
    }
  },
  "shortroot": "~/drupal8",
  "ssh_agent_status": "healthy",
  "status": "running",
  "status_desc": "running",
  "type": "drupal10",
  "urls": [
    "http://127.0.0.1:80"
  ],
  "webimg": "ddev/ddev-webserver:v1.24.7",
  "webserver_type": "apache-fpm",
  "xdebug_enabled": false,
  "xhgui_https_url": "https://drupal8.ddev.site:8142",
  "xhgui_status": "disabled",
  "xhgui_url": "http://drupal8.ddev.site:8143",
  "xhprof_mode": "prepend"
}

Possibly relevant stack traces from logs:

PhpServer.setHost must not be null

java.lang.IllegalArgumentException: Argument for @NotNull parameter 'host' of com/jetbrains/php/config/servers/PhpServer.setHost must not be null
	at com.jetbrains.php.config.servers.PhpServer.$$$reportNull$$$0(PhpServer.java)
	at com.jetbrains.php.config.servers.PhpServer.setHost(PhpServer.java)
	at de.php_perfect.intellij.ddev.php.server.ServerConfigManagerImpl.configure(ServerConfigManagerImpl.java:56)
	at de.php_perfect.intellij.ddev.php.server.ConfigureServerListener.onDescriptionChanged(ConfigureServerListener.java:40)
	at com.intellij.util.messages.impl.MessageBusImplKt.invokeMethod(MessageBusImpl.kt:818)
	at com.intellij.util.messages.impl.MessageBusImplKt.invokeListener(MessageBusImpl.kt:762)
	at com.intellij.util.messages.impl.MessageBusImplKt.deliverMessage(MessageBusImpl.kt:501)
	at com.intellij.util.messages.impl.MessageBusImplKt.pumpWaiting(MessageBusImpl.kt:480)
	at com.intellij.util.messages.impl.MessageBusImplKt.access$pumpWaiting(MessageBusImpl.kt:1)
	at com.intellij.util.messages.impl.MessagePublisher.invoke(MessageBusImpl.kt:543)
	at jdk.proxy14/jdk.proxy14.$Proxy290.onDescriptionChanged(Unknown Source)
	at de.php_perfect.intellij.ddev.state.DdevStateManagerImpl.checkChanged(DdevStateManagerImpl.java:128)
	at de.php_perfect.intellij.ddev.state.DdevStateManagerImpl.updateDescription(DdevStateManagerImpl.java:99)
	at de.php_perfect.intellij.ddev.state.StateWatcherImpl.lambda$startWatching$0(StateWatcherImpl.java:36)
	at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:326)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at com.intellij.util.concurrency.ContextCallable.lambda$call$1(ContextCallable.java:86)
	at com.intellij.util.concurrency.ContextCallable.call(ContextCallable.java:95)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:167)
	at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:167)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:173)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:167)
	at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
	at java.base/java.lang.Thread.run(Thread.java:1583)

de.php_perfect.intellij.ddev.service_actions.ServiceActionManagerImpl - Skipping open action for service ddev-drupal8-web because of its invalid URI

2025-09-10 19:55:12,840 [17720988]   WARN - de.php_perfect.intellij.ddev.service_actions.ServiceActionManagerImpl - Skipping open action for service ddev-drupal8-web because of its invalid URI
java.net.URISyntaxException: Expected scheme-specific part at index 6: https:
	at java.base/java.net.URI$Parser.fail(URI.java:2995)
	at java.base/java.net.URI$Parser.failExpecting(URI.java:3001)
	at java.base/java.net.URI$Parser.parse(URI.java:3201)
	at java.base/java.net.URI.<init>(URI.java:645)
	at de.php_perfect.intellij.ddev.service_actions.ServiceActionManagerImpl.extractServiceUri(ServiceActionManagerImpl.java:94)
	at de.php_perfect.intellij.ddev.service_actions.ServiceActionManagerImpl.mapToServiceNameWithAction(ServiceActionManagerImpl.java:70)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1858)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at de.php_perfect.intellij.ddev.service_actions.ServiceActionManagerImpl.updateActionsByDescription(ServiceActionManagerImpl.java:58)
	at de.php_perfect.intellij.ddev.service_actions.ServiceActionChangedListener.onDescriptionChanged(ServiceActionChangedListener.java:18)
	at com.intellij.util.messages.impl.MessageBusImplKt.invokeMethod(MessageBusImpl.kt:818)
	at com.intellij.util.messages.impl.MessageBusImplKt.invokeListener(MessageBusImpl.kt:762)
	at com.intellij.util.messages.impl.MessageBusImplKt.deliverMessage(MessageBusImpl.kt:501)
	at com.intellij.util.messages.impl.MessageBusImplKt.pumpWaiting(MessageBusImpl.kt:480)
	at com.intellij.util.messages.impl.MessageBusImplKt.access$pumpWaiting(MessageBusImpl.kt:1)
	at com.intellij.util.messages.impl.MessagePublisher.invoke(MessageBusImpl.kt:543)
	at jdk.proxy14/jdk.proxy14.$Proxy290.onDescriptionChanged(Unknown Source)
	at de.php_perfect.intellij.ddev.state.DdevStateManagerImpl.checkChanged(DdevStateManagerImpl.java:128)
	at de.php_perfect.intellij.ddev.state.DdevStateManagerImpl.updateConfiguration(DdevStateManagerImpl.java:77)
	at de.php_perfect.intellij.ddev.state.StateWatcherImpl.lambda$startWatching$0(StateWatcherImpl.java:35)
	at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:326)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at com.intellij.util.concurrency.ContextCallable.lambda$call$1(ContextCallable.java:86)
	at com.intellij.util.concurrency.ContextCallable.call(ContextCallable.java:95)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:167)
	at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:167)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:173)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:167)
	at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
	at java.base/java.lang.Thread.run(Thread.java:1583)

lpeabody avatar Sep 11 '25 13:09 lpeabody

It looks like you're not using the router, or your ports statement would break everything, so I guess you have it turned off.

Then you seem to be using the 127.0.0.1 URLs given by ddev describe? Those don't have a hostname.

If you really wanted to do what you're doing I would recommend avoiding the docker-compose.*.yaml and instead using the standard DDEV config options (if you have to, not recommended, may not work with PhpStorm extension):

host_webserver_port: 80
host_https_port: 443
web_environment:
  - DRUSH_OPTIONS_URI=127.0.0.1
  - DRUSH_ALLOW_XDEBUG=1

But overall, I recommend turning on the router and letting it do its job. Come on over to Discord if you want to discuss configuration, https://ddev.com/s/discord

rfay avatar Sep 11 '25 13:09 rfay

I'm bouncing back from the frankenphp thread. I haven't been able to dig too much more into this but will have time this weekend.

The interesting thing to me is why there is a difference between ddev describe and the value of DDEV_PRIMARY_URL in the container? Why is it set for ddev describe but not translating to the environment variables?

coder@les-test-1:~/drupal8$ ddev describe --json-output | jq .raw.primary_url
"http://127.0.0.1:80"
coder@les-test-1:~/drupal8$ ddev exec env | grep DDEV_PRIMARY_URL
DDEV_PRIMARY_URL_WITHOUT_PORT=
DDEV_PRIMARY_URL=
DDEV_PRIMARY_URL_PORT

lpeabody avatar Sep 12 '25 18:09 lpeabody

The interesting thing to me is why there is a difference between ddev describe and the value of DDEV_PRIMARY_URL in the container?

  • https://github.com/ddev/ddev/issues/7221

stasadev avatar Sep 12 '25 19:09 stasadev