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

Error in PHP Storm every time I open a project

Open RickKukiela opened this issue 1 year ago • 11 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)

61181116a9fb404b8527b772059069ee

Describe the bug

java.lang.NullPointerException: Cannot invoke "de.php_perfect.intellij.ddev.dockerCompose.DdevComposeFileLoader.load()" because the return value of "de.php_perfect.intellij.ddev.dockerCompose.DdevComposeFileLoader.getInstance(com.intellij.openapi.project.Project)" is null at de.php_perfect.intellij.ddev.node.AutoConfigureNodeInterpreterListener.onDescriptionChanged(AutoConfigureNodeInterpreterListener.java:30) at com.intellij.util.messages.impl.MessageBusImplKt.invokeMethod(MessageBusImpl.kt:768) at com.intellij.util.messages.impl.MessageBusImplKt.invokeListener(MessageBusImpl.kt:712) at com.intellij.util.messages.impl.MessageBusImplKt.deliverMessage(MessageBusImpl.kt:451) at com.intellij.util.messages.impl.MessageBusImplKt.pumpWaiting(MessageBusImpl.kt:430) at com.intellij.util.messages.impl.MessageBusImplKt.access$pumpWaiting(MessageBusImpl.kt:1) at com.intellij.util.messages.impl.MessagePublisher.invoke(MessageBusImpl.kt:493) at jdk.proxy17/jdk.proxy17.$Proxy235.onDescriptionChanged(Unknown Source) at de.php_perfect.intellij.ddev.state.DdevStateManagerImpl.checkChanged(DdevStateManagerImpl.java:100) at de.php_perfect.intellij.ddev.state.DdevStateManagerImpl.initialize(DdevStateManagerImpl.java:49) at de.php_perfect.intellij.ddev.state.DdevStateManagerImpl.initialize(DdevStateManagerImpl.java:33) at de.php_perfect.intellij.ddev.InitPluginActivity.lambda$execute$0(InitPluginActivity.java:19) at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport$executeOnPooledThread$1.run(AnyThreadWriteThreadingSupport.kt:167) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) at com.intellij.util.concurrency.ContextCallable.lambda$call$1(ContextCallable.java:74) at com.intellij.util.concurrency.ContextCallable.call(ContextCallable.java:83) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:101) at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:101) at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:107) at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:101) 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)

Steps to reproduce

Have PHP Storm 2024.3+ on windows and plugin version 1.2.5 installed and open a project.

Additional context

No response

RickKukiela avatar Jan 06 '25 17:01 RickKukiela

The extension tries to use your docker-compose in the private location where DDEV puts its private docker-compose. If you have perhaps overridden that or somehow it has become unset, consider setting it correctly.

See https://ddev.readthedocs.io/en/stable/users/install/phpstorm/#prerequisite

rfay avatar Jan 06 '25 17:01 rfay

Given I run my ddev inside WSL2 and my PHPStorm instance is running in the host machine, there is apparently no way to make this work nor is there any way to make the warning popup go away? I'm keeping the extension since it appears to at least keep the database port synced up and the local server mappings updated automatically (I think?) even with the issue....

RickKukiela avatar Mar 21 '25 00:03 RickKukiela

Hope you're doing OK with this, but loads of people are successfully using PhpStorm on host, DDEV with WSL2, etc. at this time. As you see, nobody else reported or added anything in the 2 months you had this open. @AkibaAT, one of the maintainers of this, runs your exact environment.

rfay avatar Mar 21 '25 04:03 rfay

@rfay I cannot remember now where I read this but I remember reading that there was some issue with the way PHPStorm settings work that did not allow this to be configured properly. Since I couldn't remember, I tried to follow the "instructions" again and still cannot get this to work. When I configure PHPStorm / Docker settings, I set it to use the WSL docker (I do not have docker desktop installed rather use the WSL2 docker-ce wrapper) and put in the path to docker, this works correct as indicated by the UI when I put this in (version number shown, connected message):

Image

The docker-compose binary field is what is giving me fits at this point. I read that I want to use the docker-compose binary that lives in my home directory's .ddev folder (/home/USERNAME/.ddev/bin/docker-compose) from my WSL2 system.

When I hover the field where I entered that path in the settings UI I am given this message:

Image

And that path is good for my system:

Image

Also, when I use the "browse to the file" for the docker compose binary, the directory ~/.ddev/bin/ shows no files to choose (the docker-compose binary that is present is not listed or choosable):

Image

I have to guess that the reason this is not working might be due to the fact that I docker-ce inside WSL rather than using Docker Desktop but I don't really know, I just don't have any other guesses at the moment as to why this isn't working.

RickKukiela avatar Mar 21 '25 20:03 RickKukiela

If your ~/.ddev/bin folder doesn't have anything in it, maybe

  • You have set XDG_CONFIG_HOME, see https://ddev.readthedocs.io/en/stable/users/usage/architecture/#global-files
  • You are not actually executing DDEV in WSL2

DDEV can't work even a little bit without downloading docker-compose into its global bin directory, so you wouldn't be able to ddev start at all.

If you provide the output of ddev debug test preferably as a file or as a gist at gist.github.com I may be able to help more.

Do a search for docker-compose and see where you find it.

rfay avatar Mar 21 '25 20:03 rfay

@rfay But thats the strange thing. That folder has the docker-compose binary inside of it. PHPStorm just refuses to acknowledge that reality... See the screen shot of my shell ls -la command that shows the out put of the path to the the file with the file size and all.

Image

RickKukiela avatar Mar 21 '25 20:03 RickKukiela

You explained above that there was nothing in the directory (I thought). Do you have more than one WSL2 distro? Are you looking at the wrong one?

rfay avatar Mar 21 '25 21:03 rfay

A misunderstanding I guess... I was trying it explain how the file is present in reality but in PHPStorm the file is not visible whether I browse to that directory or I type it in manually the outcome is the same.

I only have a single distro installed (Ubuntu) on WSL2. WSL1 is not enabled on my system in the "add/remove system features" area as the setup instructions I followed said to not enable it or that it was not necessary.

Image

RickKukiela avatar Mar 21 '25 21:03 RickKukiela

I'll try to take a look in the next few days when I have a WSL2 machine in my hands.

rfay avatar Mar 21 '25 21:03 rfay

I just went through the process and used the plugin here (which doesn't require you to do anything else) and everything "just worked".

When I experimented with setting a path to docker-compose (with manual instead of automatic path settings) I couldn't get PhpStorm to do it properly; it wanted to use a Windows path and seemed to get lost.

What I did though was this, please try it:

  • Uninstall the ddev plugin, it will want to restart PhpStorm, so restart PhpStorm
  • After the restart, exit PhpStorm.
  • Now delete all the PhpStorm settings from your project, rm -r .idea
  • Now start PhpStorm and install the plugin.

My experience was that everything was immediately set up successfully by the plugin and I didn't have to do anything at all.

If you can't figure this out still, we can make an appointment and do a screenshare session.

rfay avatar Mar 22 '25 05:03 rfay

I'm only using the automatic detection myself. However, I can confirm the issue with manual configuration in PhpStorm 2024.3.5: Image

This seems to be fixed in PhpStorm 2025.1: Image

AkibaAT avatar Apr 17 '25 06:04 AkibaAT

I can confirm, the docker-compose binary issue has resolved in 2025.1:

Image

However, I am still getting the two errors related to this plugin when I open a project:

Image

Image

I reported both through the report feature to be clear:

Report ID1: 73371962c10540cdb79ce411e65f662d Report ID2: 7cd88ebe8c4f43fe93e2108b088bd427

FTR, my phpstorm is native windows installed. My projects all live in WSL2/Ubuntu which is a VM mounted at \\wsl.localhost\Ubuntu (from windows). When I open my projects from PHP Storm the the IDE is opening in folder path like so: \\wsl.localhost\Ubuntu\home\<user>\projects\<project-name> I'm not sure if this matters but I'm just trying to be clear with the details of my setup.

java.lang.NullPointerException: Cannot invoke "de.php_perfect.intellij.ddev.dockerCompose.DdevComposeFileLoader.load()" because the return value of "de.php_perfect.intellij.ddev.dockerCompose.DdevComposeFileLoader.getInstance(com.intellij.openapi.project.Project)" is null
	at de.php_perfect.intellij.ddev.php.ConfigurationProviderImpl.configure(ConfigurationProviderImpl.java:38)
	at de.php_perfect.intellij.ddev.php.AutoConfigurePhpInterpreterListener.onDescriptionChanged(AutoConfigurePhpInterpreterListener.java:22)
	at com.intellij.util.messages.impl.MessageBusImplKt.invokeMethod(MessageBusImpl.kt:768)
	at com.intellij.util.messages.impl.MessageBusImplKt.invokeListener(MessageBusImpl.kt:712)
	at com.intellij.util.messages.impl.MessageBusImplKt.deliverMessage(MessageBusImpl.kt:451)
	at com.intellij.util.messages.impl.MessageBusImplKt.pumpWaiting(MessageBusImpl.kt:430)
	at com.intellij.util.messages.impl.MessageBusImplKt.access$pumpWaiting(MessageBusImpl.kt:1)
	at com.intellij.util.messages.impl.MessagePublisher.invoke(MessageBusImpl.kt:493)
	at jdk.proxy17/jdk.proxy17.$Proxy232.onDescriptionChanged(Unknown Source)
	at de.php_perfect.intellij.ddev.state.DdevStateManagerImpl.checkChanged(DdevStateManagerImpl.java:100)
	at de.php_perfect.intellij.ddev.state.DdevStateManagerImpl.initialize(DdevStateManagerImpl.java:49)
	at de.php_perfect.intellij.ddev.state.DdevStateManagerImpl.initialize(DdevStateManagerImpl.java:33)
	at de.php_perfect.intellij.ddev.InitPluginActivity.lambda$execute$0(InitPluginActivity.java:19)
	at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:265)
	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:102)
	at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:102)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:108)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:102)
	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)

and

java.lang.NullPointerException: Cannot invoke "de.php_perfect.intellij.ddev.dockerCompose.DdevComposeFileLoader.load()" because the return value of "de.php_perfect.intellij.ddev.dockerCompose.DdevComposeFileLoader.getInstance(com.intellij.openapi.project.Project)" is null
	at de.php_perfect.intellij.ddev.node.AutoConfigureNodeInterpreterListener.onDescriptionChanged(AutoConfigureNodeInterpreterListener.java:30)
	at com.intellij.util.messages.impl.MessageBusImplKt.invokeMethod(MessageBusImpl.kt:768)
	at com.intellij.util.messages.impl.MessageBusImplKt.invokeListener(MessageBusImpl.kt:712)
	at com.intellij.util.messages.impl.MessageBusImplKt.deliverMessage(MessageBusImpl.kt:451)
	at com.intellij.util.messages.impl.MessageBusImplKt.pumpWaiting(MessageBusImpl.kt:430)
	at com.intellij.util.messages.impl.MessageBusImplKt.access$pumpWaiting(MessageBusImpl.kt:1)
	at com.intellij.util.messages.impl.MessagePublisher.invoke(MessageBusImpl.kt:493)
	at jdk.proxy17/jdk.proxy17.$Proxy232.onDescriptionChanged(Unknown Source)
	at de.php_perfect.intellij.ddev.state.DdevStateManagerImpl.checkChanged(DdevStateManagerImpl.java:100)
	at de.php_perfect.intellij.ddev.state.DdevStateManagerImpl.initialize(DdevStateManagerImpl.java:49)
	at de.php_perfect.intellij.ddev.state.DdevStateManagerImpl.initialize(DdevStateManagerImpl.java:33)
	at de.php_perfect.intellij.ddev.InitPluginActivity.lambda$execute$0(InitPluginActivity.java:19)
	at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:265)
	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:102)
	at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:102)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:108)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:102)
	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)

RickKukiela avatar Apr 28 '25 15:04 RickKukiela

It's almost the same setup I use, apart from me using Docker Desktop on Windows instead of WSL. I can get the same exception by disabling the Docker plugin in PhpStorm, but your screenshot shows that Docker integration is available, so that's not it.

It the Docker integration working in the IDE? Can you please add a screenshot of the Docker panel in PhpStorm after connecting to Docker? Should look something like this:

Image

AkibaAT avatar Apr 28 '25 16:04 AkibaAT

I switched my setup to Docker on WSL, but no exception there either for me. So my current guesses are either some sort of load order issue, where the code is running before the Docker plugin is initialized, or compatibility issues with another plugin.

I did encounter a probably unrelated additional issue with PhpStorm itself while trying to replicate the problem: Image PhpStorm is trying to use the docker-compose.yml in the root of the project, ignore the setting of files to use, lovely.

AkibaAT avatar Apr 28 '25 17:04 AkibaAT

I will preface this with the fact that I do not really "use" docker outside of the fact that my ddev setup needs it to function so I'm not really sure what all this is even for or what I would use this panel for. In-fact, I've never even looked in this panel once before now.

I'm also not running any sort of windows desktop docker / manager. My only "docker" software installed is the DDEV for Windows installation recommendation: Using WSL2/Ubuntu and Docker CE installed in WSL along with DDEV.

For the screenshots: The various projects of which I have an active ddev session or recent ddev session are listed on the left panel and can be expanded to show all kinds of stuff. Both the "Dev Containers" and "Containers" panels show nothing:

Image

and

Image

Here is one of the "healthy" docker compose entries expanded:

Image

RickKukiela avatar Apr 28 '25 20:04 RickKukiela

Please try the test build of the PR I just pushed: ddev-intellij-plugin-0.0.1-dev.zip You can install it via Plugins > Install Plugin from Disk

I've updated the dependency checks and the initialization of the plugin. This fixes cases I could reproduce myself, and hopefully yours as well. But since I couldn't replicate it exactly, please try and let me know.

AkibaAT avatar Apr 28 '25 21:04 AkibaAT

@AkibaAT

I uninstalled the "store" version and then reinstalled it from the zip. Upon restarting I got this message:

You must enable the org.jetbrains.plugins.phpstorm-docker plugin to use the PHP interpreter auto-registration.

However, this is strange because the plugin I believe that is referring to is a bundled plugin that is installed and enabled:

Image

RickKukiela avatar Apr 29 '25 01:04 RickKukiela

org.jetbrains.plugins.phpstorm-docker is the PHP Docker extension, which is required to run PHP via Docker: Image The warning is issued by the DDEV extension if the checkbox to automatically configure PHP is enabled, without the PHP Docker extension being available: Image

AkibaAT avatar Apr 29 '25 07:04 AkibaAT

Since this is also a bundled extension, this is likely just a little bit further down from where your screenshot cut off. This should also be enabled out of the box, please check.

AkibaAT avatar Apr 29 '25 07:04 AkibaAT

I wonder how this was even disabled... ffs.. After enabling that extension the problem is resolved!

Thank you for looking into this and helping figure out what the issue was!

RickKukiela avatar Apr 29 '25 15:04 RickKukiela

Ah, good to hear! Thanks for sticking through it as well.

AkibaAT avatar Apr 29 '25 15:04 AkibaAT