laravel-shift / cli

A tool to run automated tasks for maintaining your Laravel projects.
MIT License
58 stars 6 forks source link

Fatal error when running shift-cli #7

Closed mberneis closed 1 year ago

mberneis commented 1 year ago

Issue:

Get fatal error when running shift-cli

Command:

shift-cli

Output:

Fatal error: Uncaught Error: Call to undefined function _HumbugBox31b2283d0314\app() in phar:///Users/mberneis/.composer/vendor/laravel-shift/cli/builds/shift-cli/vendor/autoload.php:64
Stack trace:
#0 /Users/mberneis/dev/nanofetch-21/vendor/spatie/ray/src/helpers.php(23): app('Spatie\\LaravelR...')
#1 /Users/mberneis/dev/nanofetch-21/vendor/spatie/ray/src/helpers.php(55): ray()
#2 [internal function]: {closure}()
#3 {main}
  thrown in phar:///Users/mberneis/.composer/vendor/laravel-shift/cli/builds/shift-cli/vendor/autoload.php on line 64

Before/After Snippets:

// PLEASE PASTE THE CODE SNIPPET BEFORE RUNNING THE COMMAND...
// PLEASE PASTE THE CODE SNIPPET AFTER RUNNING THE COMMAND...
jasonmccreary commented 1 year ago

This is a known bug/incompatibility with Spatie's Ray package. As a temporary work around, you may remove the spatie/ray package.

AdamWills commented 1 year ago

Just ran into this myself. Will likely hold off adding shift-cli until this is resolved.

Looking forward to using this!

tshafer commented 1 year ago

Same problem, going to hold off as well.

jasonmccreary commented 1 year ago

I'll take a look at this today. It's something with the bundling either in the Shift CLI or Ray.

jasonmccreary commented 1 year ago

@mberneis, I'm not able to reproduce this error. I believe this happens if the Shift CLI encounters an error when it runs and is attempting to send it to Ray.

Can you let me know if this happens when you run a single, simple task like down-migration.

Also if you are running the Ray app in the background or just the open source package?

mberneis commented 1 year ago

@jasonmccreary - I am not running ray (although I have it in my composer but I have not started the ray app at the moment)

The error appears only with one task:

shift-cli run model-table

I have no explicit ray calls but something throws an error. However, my laravel log does not show any error when I run the shift command

AdamWills commented 1 year ago

I'm having the same experience with that single shift if that's helpful at all.

jasonmccreary commented 1 year ago

Thanks @mberneis, that does help.

I have pushed a new build (0.2.8) which I believe will solve this problem. Please run composer update and let me know. Note: I have not rebuilt the cli-premium package. I want to ensure this works first.

mberneis commented 1 year ago

Yes, no more errors (the model-table task did not make any changes to my code, but probably none were needed) Thanks, JMac!

AdamWills commented 1 year ago

Confirmed that the new release is working over here as well!

Thanks!

jasonmccreary commented 1 year ago

Woohoo!

Thanks all. And thanks @freekmurze for granting my access to Ray so I could diagnose the issue. It was the bundling for Shift CLI, but the stack trace was nonetheless helpful.