spatie / ray

Debug with Ray to fix problems faster
https://myray.app
MIT License
568 stars 102 forks source link

Ray not working Mac OS Big sur #597

Closed sandersjj closed 2 years ago

sandersjj commented 2 years ago

Describe the bug Hey I am running a statamic project on laravel valet. When I want to debug some variables or anything liie ray('hello'), no ouput is whown to the ray app.

Versions Version 1.18.5 (1.18.5)

You can use composer show to get the version numbers of:

PHP version: Laravel version (if applicable):8.0.12

To Reproduce Steps to reproduce the behavior:

  1. Install a statamic project
  2. go to public/index.php. This is basically the same file as in any Laravel project
  3. After $response->send() type ray('hello');
  4. Nothing happends

Expected behavior I expect output in the ray app.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

AdrianMrn commented 2 years ago

@riasvdv Do you know if any specials steps are needed to get Ray working on Statamic?

sandersjj commented 2 years ago

@AdrianMrn it should work out of the box. No special steps needed.

freekmurze commented 2 years ago

Ray simply listens on port 23517 for incoming requests. Is there anything on your system that might already be using this port?

You could also try to create a minimal example. Run "composer require spatie/ray" in an empty directory, create an index.php, and include the generated autoloader. In that script, also try to add ray('hello');. Excute that file with php index.php and take a look in Ray if you received that message.

We also released 1.19 of Ray yesterday, try upgrade to that version to see if it works.

sandersjj commented 2 years ago

Do I need to do anything more than that? B/c I did exactly as you mentioned, in an empty folder. It installed version 1.31

php index.php resulted in Fatal error: Uncaught Error: Call to undefined function ray() in

freekmurze commented 2 years ago

Have you included the autoloader created by composer?

sandersjj commented 2 years ago

Got it working now in a simple example. However when I do a ray('hello);right afterrequire DIR.'/../vendor/autoload.php';in thepublic/index.php` I get no output.

I also checked what listens on port 23517 this is just Ray.

So in conclusion: working in a very basic example, however not in a statamic/ laravel project.

hypnotox commented 2 years ago

Same issue as @sandersjj. It does work if i setup a small example project, require spatie/ray and call ray("TEST"). It also works with a new Laravel project and both spatie/ray and spatie/laravel-ray. But it does not work with a Laravel 8 project where it has worked before.

I reinstalled ray, dropped spatie/laravel-ray and used spatie/ray directly, removed vendor and reinstalled all dependencies to no avail. It does not receive any calls. I also tried calling it in the index.php file, enabling request and queries being sent to ray automatically, but nothing worked.

This has been ongoing for me in the last months (since August if i remember correctly) with this project. Any help would be appreciated.

freekmurze commented 2 years ago

You could try to determine if your app is really sending something to Ray, by adding maybe a var_dump statement here: https://github.com/spatie/ray/blob/d7ec299dd01a930994bd798ae9611fdf573c3dec/src/Client.php#L63

sandersjj commented 2 years ago

I can confirm that my APP_ENV is set to local.

The var_dump results in:

object(Spatie\Ray\Request)#48 (3) { ["uuid":protected]=> string(36) "97541dee-df28-4f12-8db1-a6c2f7f25e65" ["payloads":protected]=> array(1) { [0]=> object(Spatie\Ray\Payloads\LogPayload)#50 (3) { ["values":protected]=> array(1) { [0]=> string(5) "hello" } ["remotePath"]=> NULL ["localPath"]=> NULL } } ["meta":protected]=> array(3) { ["php_version"]=> string(6) "8.0.12" ["php_version_id"]=> int(80012) ["ray_package_version"]=> string(8) "1.32.0.0" } }

Which is ok I guess. Not clear why it isn't arriving in the Ray app itself.

freekmurze commented 2 years ago

From that point on it will try to send a message to ray via port 23517. Is that port free on your machine?

sandersjj commented 2 years ago

lsof -nP -iTCP -sTCP:LISTEN | grep 23517 returns Ray

AdrianMrn commented 2 years ago

I'm going to close this issue because it's been inactive for a while. Let me know if you still need help with this problem!