beyondcode/laravel-dump-server

Issue with Symfony when trying to add this to a setup using Laravel v6

acidjazz opened this issue ยท 29 comments


Using version ^1.3 for beyondcode/laravel-dump-server
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing beyondcode/laravel-dump-server (1.3.0): Loading from cache
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In Connection.php line 32:

  Argument 1 passed to Symfony\Component\VarDumper\Server\Connection::__const
  ruct() must be of the type string, null given, called in /Users/k/kh/sink/v
  endor/beyondcode/laravel-dump-server/src/DumpServerServiceProvider.php on l
  ine 49

I'm unable to reproduce this issue. This happens when there is no host configured in your debug-server configuration file. Do you have this in place?

@mpociot this happens when i try to add the package, so no i don't have a config/dump-server.php added just yet, i tried copying one over manually before doing this, and still i get the same error

@mpociot additional info: this is duplicateable on my laravel+nuxt boilerplate

just run a composer install and then require --dev this package

It's pretty strange, the debug-server config does not get loaded in and $host is always null

So I went through and compared my setup with a v6 as an upgrade compared to a fresh laravel new and after copying certain files over my issue disappeared.

I wonder if this is related to the AppServiceProvider changes, more details here:

fumeapp/laranuxt@0d7da47

@acidjazz I'm having exactly the same problem. Which files did you copied?

@jorshhh I just did a fresh v6 laravel new to get this working and then moved my IP into it

I'm also getting this with a fresh v6 install.

I'm also getting this, but not a fresh install. It work fine previously, I think I broke it with a composer update.

@dellow @acidjazz @jorshhh I think the issue comes from the fact that the configuration was cached without the debug-server config.

Basically, the file bootstrap/cache/config.php doesn't contain the debug-server key. If you delete this file, you will most likely clear the error as well.

@lucasmichot @mpociot I re-opened this issue since @hawezo found the actual solution to it, is there something we can do to fix this in the package?

@lucasmichot @mpociot I re-opened this issue since @hawezo found the actual solution to it, is there something we can do to fix this in the package?

Sorry, but I am not sure why you mention me @acidjazz ?

@lucasmichot sorry, just because I notice you are a major contributor :)

Hello,

I got the same issue :
Argument 1 passed to Symfony\Component\VarDumper\Server\Connection::__const ruct() must be of the type string, null given, called in ...

In my case, I got it after a composer update command today, and I can also reproduce it :
โ€ข composer create-project --prefer-dist laravel/laravel _TEST_ to install a fresh laravel V6 project
โ€ข my route Route::get('/echo-phpinfo', function(){ phpinfo(); }); works well
โ€ข add "beyondcode/laravel-dump-server": "^1.0", in my "require-dev" (composer.json)
โ€ข my route /echo-phpinfo will then trigger the error

Now, if I delete the config.php file and rebuild it with a php artisan config:cache then I have no errors at all, but my site serves a blank page for the route /echo-phpinfo (no return, nothing, even if the .env file is set on APP_DEBUG=true)

And sadly, even if I remove the line "beyondcode/laravel-dump-server": "^1.0" in the composer.json file, I still get the blank page, even with cache cleaninig, autoload dumping or server restarting etc...

I also notice that Digital Ocean sends to me several alerts because of running high CPU during this bug.

Hello,

I had this exact same issue where I couldn't successfully install dump-server via composer require --dev beyondcode/laravel-dump-server.

As @mpociot stated above, the $host var was indeed null.

Here's what I did to solve it:

  • I copied ~/config/config.php (from this repo) to ~/config/debug-server.php.
    cp vendor/beyondcode/laravel-dump-server/config/config.php config/debug-server.php
  • I opened vendors/beyond-code/laravel-dump-server/DumpServerServiceProvider.php
  • I went to line 34 after public function register() { and just added a simple return ;.
  • Then in my console I ran php artisan config:cache

From there, I confirmed $host now has the proper value, and reverted the changes made to DumpServerServiceProvider.php.

The new config cached and I can now run the dump-server.

I hope this helps someone else!

It seems to happen in production env only because local and staging work fine
I run into this issue after upgrade laravel 5.8 to 6. Before this, the same version worked fine

Same issue is persisiting on Laravel 7.

Same issue on laravel 7.

Works in Local server, but in production does not work

The issue does arise on a non-dev environment, but I don't really need the package on a production/staging server.

My mistake was to use composer upgrade when what I really wanted was composer upgrade --no-dev

So if you mistakenly upgraded your production/staging environment without --no-dev flag, then make sure you add it, run the command and everything should be fine.

i don't know why this issue still exists, but it never fails to be annoying

Fresh Laravel v8 install

โฏ composer require --dev beyondcode/laravel-dump-server
Using version ^1.5 for beyondcode/laravel-dump-server
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing beyondcode/laravel-dump-server (1.5.0): Downloading (100%)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In Connection.php line 32:

  Argument 1 passed to Symfony\Component\VarDumper\Server\Connection::__const
  ruct() must be of the type string, null given, called in /Users/k/cnam/vend
  or/beyondcode/laravel-dump-server/src/DumpServerServiceProvider.php on line
   49

@mpociot you sure you still are unable to get this? I cannot avoid it

@acidjazz Try running following artisan command php artisan optimize

same issue after upgrade to laravel 8 from 7

@dev-technoscore just to be clear, there are Many work-arounds, but we're still trying to squash the issue from happening in the first place.

I still get this issue, google it, and find this issue being my 1st result. Every time I composer reqjuire

@mpociot @bezhermoso @tortuetorche @lucasmichot @freekmurze

+1

was on the wrong php version.
after changing to php 8.1 it was fixed.

3dr14n commented

The issue does arise on a non-dev environment, but I don't really need the package on a production/staging server.

My mistake was to use composer upgrade when what I really wanted was composer upgrade --no-dev

So if you mistakenly upgraded your production/staging environment without --no-dev flag, then make sure you add it, run the command and everything should be fine.

Thank you! This fixed my issue during update so the fix in my production server was by running composer update --no-dev command.

The issue only happened on the production server where the environment was set to production and does not happen in the project with environment set to local.

joke2k commented

Hi @acidjazz and others,
I spent the last hour on this issue and I would like to share here what I found.

My problem with this happened randomly when I execute:

  • parallel testing
  • inside a docker container
  • with a custom bootstrap php file configured in the phpunit.xml
  • php8.0
  • laravel9

In this bootstrap file, I run the config:cache command in order to have a fresh cache file for testing configuration before all the tests are executed. (i've a huge config file, and parsing it for 5k tests is not the best).

The issue happened when the LoadConfiguration::bootstrap cannot find the cache file (don't know why, maybe is not been written yet by the config:cache in the bootstrap ๐Ÿคทโ€โ™‚๏ธ ), it reloads the whole configuration, but when DumpServerServiceProvider::register() execute the ServiceProvider::mergeConfigFrom to add its debug-server configuration, this is skipped (!) because the app->configurationIsCached() returns true (now the cache file exists :/).

I don't know if it is relevant, but it happens "always" when I try to use some MakeHttpRequests methods to call my application.

If I remove the bootstrap file and run config:cache manually before the tests, everything works as expected.