spatie / ray

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

[V. 1.30.0] Passing a Response fails with ".. must be of the type string, object given .." (works with V. 1.29.2) #552

Closed ibrainventures closed 2 years ago

ibrainventures commented 3 years ago

Before creating a new bug report Please check if there isn't a similar issue on the issue tracker or in the discussions.

If you are having troubles connecting your project to Ray, please check our docs first, especially the configuration and environment specific configuration sections.

Describe the bug A clear and concise description of what the bug is.

Versions Ray version (you can see this in "About Ray"): 1.17.0

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

PHP version: 7.4 Laravel version (if applicable):

Working with Spatie Medialibrary and Ray.

Ray-ing the the $addMediaResponse

        $addMediaResponse = $this->addmediaObj
            ->addMedia($entrycreateAddedMediaFilePathComplete)
            ->usingFileName($filenameJpgToUse)
            ->withCustomProperties(['custom_file_path' => $customFilePathToUse])
            ->preservingOriginal()
            ->storingConversionsOnDisk('v100-nfs-nlim-cd7-poi-live')
            ->toMediaCollection($targetCollection, $targetBackupArchivDiskName);

with ray($addMediaResponse);

now fails with:

TypeError {#2537 ▼
  #message: "Argument 1 passed to Spatie\MediaLibrary\MediaCollections\Models\Media::img() 
  must be of the type string, object given, called in /*** ▶"
  #code: 0
  #file: "/******/vendor/spatie/laravel-medialibrary/src/MediaCollections/Models/Media.php"
  #line: 322

Expected behavior

Normaly (V 1.29.2) it prints out:

Model
Class Name
App\App\MediaLibrary\MediaCollections\Models\Mediaconvert

Attributes array:18[▼"name" => "aXmj38VaYhWbeqvVadWPCOqLRgtb9S3w1OKboRrs"
  "file_name" => "449f-b1c7.jpg"
  "disk" => "v100-nfs-nlim-cd7-poi-archive"
  "conversions_disk" => "v100-nfs-nlim-cd7-poi-live"
  "collection_name" => "entry_single_image_pon"
  "mime_type" => "image/jpeg"
  "size" => 827240"custom_properties" => array:1[▶]

Composering back to V 1.29.2 and it works fine ..

Thanks for those packages.

ibrainventures commented 2 years ago

After a composer update today to following versions:

[...]
spatie/image                       1.10.5 
spatie/image-optimizer             1.4.0
spatie/laravel-medialibrary        9.8.1
spatie/laravel-ray                 1.26.1
spatie/macroable                   1.0.1
spatie/ray                         1.30.3
laravel/framework                  v8.63.0
laravel/horizon                    v5.7.13
[..]

the

ray($addMediaResponse);

is now returning the right response. No more error.

If this is bug-fix is conclusiv / not a random effect ;-) this issue can be closed.

Thank you for your work.