ray icon indicating copy to clipboard operation
ray copied to clipboard

Laravel doesn't send data to ray app

Open d-delaey opened this issue 3 years ago • 3 comments

Describe the bug Laravel doesn't send data to ray app. I tried with an PHP-Error, ray() function and with dd().

Versions 2.0.1

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

  • spatie/ray package version: Not installed
  • spatie/laravel-ray package version (if applicable): ^1.29

PHP version: Laravel version ^9.19

To Reproduce Steps to reproduce the behavior: Just using ray(), dd() or making an PHP-Error

Expected behavior Corresponding data shown in Ray APp

Desktop (please complete the following information):

  • OS: Arch Linux (btw)
  • Version 5.18.5

Additional context here is my ray.php and docker-compose.yml file and iam using laravel sail. i added host.docker.internal in my /etc/hosts file

`<?php

return [ /* * This setting controls whether data should be sent to Ray. * * By default, ray() will only transmit data in non-production environments. */ 'enable' => env('RAY_ENABLED', true),

/*
* When enabled, all cache events  will automatically be sent to Ray.
*/
'send_cache_to_ray' => env('SEND_CACHE_TO_RAY', false),

/*
* When enabled, all things passed to `dump` or `dd`
* will be sent to Ray as well.
*/
'send_dumps_to_ray' => env('SEND_DUMPS_TO_RAY', true),

/*
* When enabled all job events will automatically be sent to Ray.
*/
'send_jobs_to_ray' => env('SEND_JOBS_TO_RAY', false),

/*
* When enabled, all things logged to the application log
* will be sent to Ray as well.
*/
'send_log_calls_to_ray' => env('SEND_LOG_CALLS_TO_RAY', true),

/*
* When enabled, all queries will automatically be sent to Ray.
*/
'send_queries_to_ray' => env('SEND_QUERIES_TO_RAY', false),

/**
 * When enabled, all duplicate queries will automatically be sent to Ray.
 */
'send_duplicate_queries_to_ray' => env('SEND_DUPLICATE_QUERIES_TO_RAY', false),

/*
 * When enabled, slow queries will automatically be sent to Ray.
 */
'send_slow_queries_to_ray' => env('SEND_SLOW_QUERIES_TO_RAY', false),

/*
* When enabled, all requests made to this app will automatically be sent to Ray.
*/
'send_requests_to_ray' => env('SEND_REQUESTS_TO_RAY', false),

/**
 * When enabled, all Http Client requests made by this app will be automatically sent to Ray.
 */
'send_http_client_requests_to_ray' => env('SEND_HTTP_CLIENT_REQUESTS_TO_RAY', false),

/*
* When enabled, all views that are rendered automatically be sent to Ray.
*/
'send_views_to_ray' => env('SEND_VIEWS_TO_RAY', false),

/*
 * When enabled, all exceptions will be automatically sent to Ray.
 */
'send_exceptions_to_ray' => env('SEND_EXCEPTIONS_TO_RAY', true),

/*
* The host used to communicate with the Ray app.
* When using Docker on Mac or Windows, you can replace localhost with 'host.docker.internal'
* When using Homestead with the VirtualBox provider, you can replace localhost with '10.0.2.2'
* When using Homestead with the Parallels provider, you can replace localhost with '10.211.55.2'
*/
'host' => env('RAY_HOST', 'host.docker.internal'),

/*
* The port number used to communicate with the Ray app.
*/
'port' => env('RAY_PORT', 23517),

/*
 * Absolute base path for your sites or projects in Homestead,
 * Vagrant, Docker, or another remote development server.
 */
'remote_path' => env('RAY_REMOTE_PATH', '/var/www/html/'),

/*
 * Absolute base path for your sites or projects on your local
 * computer where your IDE or code editor is running on.
 */
'local_path' => env('RAY_LOCAL_PATH', '/home/delaey/Desktop/laravel-mitfahrapp/'),

/*
 * When this setting is enabled, the package will not try to format values sent to Ray.
 */
'always_send_raw_values' => false,

]; `

# For more information: https://laravel.com/docs/sail version: '3' services: laravel.test: build: context: ./vendor/laravel/sail/runtimes/8.1 dockerfile: Dockerfile args: WWWGROUP: '${WWWGROUP}' image: sail-8.1/app extra_hosts: - 'host.docker.internal:host-gateway' ports: - '${APP_PORT:-80}:80' - '${VITE_PORT:-5173}:${VITE_PORT:-5173}' environment: WWWUSER: '${WWWUSER}' LARAVEL_SAIL: 1 XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' volumes: - '.:/var/www/html' networks: - sail depends_on: - mariadb mariadb: image: 'mariadb:10' ports: - '${FORWARD_DB_PORT:-3306}:3306' environment: MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' MYSQL_ROOT_HOST: "%" MYSQL_DATABASE: '${DB_DATABASE}' MYSQL_USER: '${DB_USERNAME}' MYSQL_PASSWORD: '${DB_PASSWORD}' MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' volumes: - 'sail-mariadb:/var/lib/mysql' - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh' networks: - sail healthcheck: test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"] retries: 3 timeout: 5s networks: sail: driver: bridge volumes: sail-mariadb: driver: local

d-delaey avatar Jul 01 '22 19:07 d-delaey

@d-delaey check if your .env APP_ENV is set to local

whitespacecode avatar Aug 26 '22 05:08 whitespacecode

Doesn't work for me either. If I turn on logging of every single view or request, it logs, but ray('test'; or ray() anything doesn't do a thing.

octoxan avatar Sep 20 '22 19:09 octoxan

@d-delaey check if your .env APP_ENV is set to local

it does

d-delaey avatar Sep 21 '22 16:09 d-delaey

Using Laravel sail. Nothing displaying in Ray despite following documentation.

sardar1592 avatar Nov 18 '22 05:11 sardar1592

Check your .env that it's set to local

whitespacecode avatar Nov 18 '22 07:11 whitespacecode

https://github.com/spatie/ray/issues/713#issuecomment-1319653120

It is. I have tried everything. But nothing seems to work.

sardar1592 avatar Nov 18 '22 10:11 sardar1592

I ran into the same problem. It also didn't work for me in combination with Laravel sail on Windows 10.

I find the solution here: https://dev.to/stuartcreed/how-to-make-spatie-ray-work-with-laravel-sail-992

Steps to solve the problem:

  1. sail composer require spatie/laravel-ray --dev
  2. sail artisan ray:publish-config --docker
  3. Add '127.0.0.1 host.docker.internal' to /etc/hosts
  4. Set the values in ray.php to:

'host' => 'host.docker.internal', 'port' => 23517, 'remote_path' => '/var/www/html', 'local_path' => '/Users/me/projects/project'

Read the comments in the ray.php file for the correct paths.

vdlsolutions avatar Nov 25 '22 21:11 vdlsolutions

I have the exact same problem. I have tried every step in the thread.

I only manage to get something on ray when I execute things from inside the project such as an artisan command, When I try to make a request to an endpoint that contains something to be logged on ray i get nothing.

SokratesP avatar Mar 07 '23 13:03 SokratesP

In my case ufw firewall was blocking. I typically have pleasure employing netcat to debug such issues.

Running nc -vz host.docker.internal 23517 was a great way to trace down. And running sudo ufw allow 23517 fixed the blocked issue.

flexchar avatar Apr 02 '23 14:04 flexchar

In my case ufw firewall was blocking. I typically have pleasure employing netcat to debug such issues.

Running nc -vz host.docker.internal 23517 was a great way to trace down. And running sudo ufw allow 23517 fixed the blocked issue.

This worked for me - and it makes sense : the OS has to allow a particular port before it can be used

Stupid me took much longer to realise this.

jdecode avatar Jun 06 '23 09:06 jdecode

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.

spatie-bot avatar Oct 09 '23 10:10 spatie-bot