laravel-dump-server icon indicating copy to clipboard operation
laravel-dump-server copied to clipboard

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

Open acidjazz opened this issue 5 years ago • 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

acidjazz avatar Aug 30 '19 03:08 acidjazz

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 avatar Sep 03 '19 08:09 mpociot

@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

acidjazz avatar Sep 03 '19 19:09 acidjazz

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

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

acidjazz avatar Sep 03 '19 19:09 acidjazz

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

acidjazz avatar Sep 03 '19 19:09 acidjazz

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:

https://github.com/acidjazz/laranuxt/commit/0d7da471a37c90b05e156b22ca7d1cf172588cba

acidjazz avatar Sep 03 '19 20:09 acidjazz

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

jorshhh avatar Oct 11 '19 00:10 jorshhh

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

acidjazz avatar Oct 11 '19 00:10 acidjazz

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

dellow avatar Oct 23 '19 08:10 dellow

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

innocenzi avatar Oct 24 '19 21:10 innocenzi

@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.

innocenzi avatar Oct 24 '19 22:10 innocenzi

@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?

acidjazz avatar Dec 12 '19 18:12 acidjazz

@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 avatar Dec 12 '19 21:12 lucasmichot

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

acidjazz avatar Dec 12 '19 22:12 acidjazz

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.

KaminoU avatar Dec 21 '19 18:12 KaminoU

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!

MikeCraig418 avatar Jan 27 '20 23:01 MikeCraig418

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

7krasov avatar Jan 30 '20 12:01 7krasov

Same issue is persisiting on Laravel 7.

lesterchan avatar Mar 12 '20 03:03 lesterchan

Same issue on laravel 7.

Works in Local server, but in production does not work

Samuel-Bie avatar Mar 27 '20 16:03 Samuel-Bie

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.

bynicolas avatar Apr 26 '20 20:04 bynicolas

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

acidjazz avatar Sep 24 '20 16:09 acidjazz

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

acidjazz avatar Sep 24 '20 16:09 acidjazz

@acidjazz Try running following artisan command php artisan optimize

dev-technoscore avatar Sep 28 '20 11:09 dev-technoscore

same issue after upgrade to laravel 8 from 7

chuoke avatar Oct 08 '20 13:10 chuoke

@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.

acidjazz avatar Oct 08 '20 19:10 acidjazz

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

acidjazz avatar Dec 30 '20 19:12 acidjazz

+1

formikaio avatar Nov 02 '22 17:11 formikaio

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

felixwerner avatar Jan 16 '23 13:01 felixwerner

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.

3dr14n avatar Jun 01 '23 05:06 3dr14n

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 :man_shrugging: ), 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.

joke2k avatar Jul 27 '23 23:07 joke2k