Giter VIP home page Giter VIP logo

Comments (20)

thujohn avatar thujohn commented on May 22, 2024

Can you see the current job in the queue ?
What does twitter_status() ?

I still didn't try queues so I won't be very helpfull if this is the issue but I read that in the documentation :

Deleting A Processed Job

Once you have processed a job, it must be deleted from the queue.
If no exception is thrown during the execution of your job,
this will be done automatically.

If you would like to delete or release the job manually,
the Illuminate\Queue\InteractsWithQueue trait
provides access to the queue job release and delete methods.
The release method accepts a single value: the number of seconds
you wish to wait until the job is made available again.

from twitter.

joedawson avatar joedawson commented on May 22, 2024

Hey @thujohn,

I can indeed see the job in the queue, it unfortunately stays in the queue - which is odd. In the video, I briefly show the code for my command, it's supposed to post to Tumblr also (which it did before updating) - but it doesn't even get to posting to Tumblr, and that code is directly after posting to Twitter.

the twitter_status() function is a helper I have created for myself, it just generates the Twitter status from the female model. (just a string)

With regards to the queue, the job is throwing no exception so should be deleting itself just fine. It's odd that it continually fires the tweet off and doesn't proceed to the code directly below it:

/* ------------------------------------
#. Upload Photo & Post to Twitter
------------------------------------ */
$media = \Twitter::uploadMedia([
    'media' => file_get_contents($photo->path)
]);
$twitter = \Twitter::postTweet([
    'status'    => twitter_status($photo->female),
    'media_ids' => $media->media_id_string
]);
$twitter = json_decode($twitter);

/* ------------------------------------
#. Post to Tumblr
------------------------------------ */
$tumblr = new \Tumblr\API\Client(
    getenv('TUMBLR_KEY'), getenv('TUMBLR_SECRET'),
    getenv('TUMBLR_TOKEN'), getenv('TUMBLR_TOKEN_SECRET')
);

// further logic to post to Tumblr
// ...
// persists some data to the database
// ...
// etc.

I just find it a little odd that this is continually firing off the Tweet and not proceeding to the code directly below (new instantiation of Tumblr api, posting to Tumblr etc etc.).

Thanks

from twitter.

thujohn avatar thujohn commented on May 22, 2024

Very strange…

Try to replace some of your lines by var_dump()
Try to run the twitter's commands directly in a controller

Which version of package have you specified in your composer.json ?

from twitter.

joedawson avatar joedawson commented on May 22, 2024

It is indeed, I'm currently using ~2.0 of this package.

Will try some tests at lunch and will get back to you.

from twitter.

joedawson avatar joedawson commented on May 22, 2024

Hey @thujohn, just tested a few things - my error. This line:

$twitter = json_decode($twitter);

Was no longer needed, the response was already decoded (at least from what I've tested). Getting another odd bug now though unfortunately - locally, everything is working smoothly.

As I previously mentioned, I had configured everything as per the docs - meaning I had updated the path to the Twitter facade. New path:

'Twitter' => 'Thujohn\Twitter\Facades\Twitter'

So I assume I'd be ok with production as everything local is fine - but I'm receiving this error now unfortunately:

production.ERROR: exception 'ErrorException' with message 'Class 'Thujohn\Twitter\TwitterFacade' not found' in /vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php:63

I then deleted my vendor directory on my production server, deleted composer.lock and run a new composer install in the hope it would clear the reference to the old TwitterFacade. No luck.

Any ideas why I get that error on my production server, but not locally?

I would assume the above method (deleting vendor etc.) would've worked.

from twitter.

thujohn avatar thujohn commented on May 22, 2024

In fact you don't need json_encode() because you can choose the output format by passing it in parameters. By default it is set to object ( ['format' => 'object|array|json'] )

Maybe you can try php artisan clear-compiled but not sure because this shouldn't happen.
Have you checked the app.php another time ?

from twitter.

joedawson avatar joedawson commented on May 22, 2024

I see - thanks @thujohn.

Just tried php artisan clear-compiled - no luck unfortunately. The last thing I can think of trying is deleting my site off the server, then installing it again. Will try that this evening.

Thanks for all your help so far.

from twitter.

thujohn avatar thujohn commented on May 22, 2024

You can try to search "TwitterFacade" in your files to identify the cause of the problem (composer or laravel)

from twitter.

joedawson avatar joedawson commented on May 22, 2024

Yeah I tried that - I did a grep -rl "TwitterFacade" ./ from my site root but only returned the reference in the error logs. :/

from twitter.

thujohn avatar thujohn commented on May 22, 2024

And what the debug is saying ?

from twitter.

joedawson avatar joedawson commented on May 22, 2024

Just as I mentioned previously :(

[2015-03-27 14:07:54] production.ERROR: exception 'ErrorException' with message 'Class 'Thujohn\Twitter\TwitterFacade' not found' in /vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php:63

from twitter.

thujohn avatar thujohn commented on May 22, 2024

No more ?

from twitter.

joedawson avatar joedawson commented on May 22, 2024

Yep - here's the full stack:

[2015-03-27 14:07:54] production.ERROR: exception 'ErrorException' with message 'Class 'Thujohn\Twitter\TwitterFacade' not found' in /vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php:63
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Class 'Thujohn\\...', '/home/forge/ink...', 63, Array)
#1 /vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php(63): class_alias('Thujohn\\Twitter...', 'Twitter')
#2 [internal function]: Illuminate\Foundation\AliasLoader->load('Twitter')
#3 /app/Commands/PostPhotoCommand.php(64): spl_autoload_call('Twitter')
#4 [internal function]: InkedFemales\Commands\PostPhotoCommand->handle()
#5 /vendor/laravel/framework/src/Illuminate/Container/Container.php(523): call_user_func_array(Array, Array)
#6 /vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(199): Illuminate\Container\Container->call(Array)
#7 [internal function]: Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(InkedFemales\Commands\PostPhotoCommand))
#8 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): call_user_func(Object(Closure), Object(InkedFemales\Commands\PostPhotoCommand))
#9 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(InkedFemales\Commands\PostPhotoCommand))
#10 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(101): call_user_func(Object(Closure), Object(InkedFemales\Commands\PostPhotoCommand))
#11 /vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(209): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#12 /vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(42): Illuminate\Bus\Dispatcher->dispatchNow(Object(InkedFemales\Commands\PostPhotoCommand), Object(Closure))
#13 /vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(126): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\BeanstalkdJob), Array)
#14 /vendor/laravel/framework/src/Illuminate/Queue/Jobs/BeanstalkdJob.php(51): Illuminate\Queue\Jobs\Job->resolveAndFire(Array)
#15 /vendor/laravel/framework/src/Illuminate/Queue/Worker.php(207): Illuminate\Queue\Jobs\BeanstalkdJob->fire()
#16 /vendor/laravel/framework/src/Illuminate/Queue/Worker.php(159): Illuminate\Queue\Worker->process('beanstalkd', Object(Illuminate\Queue\Jobs\BeanstalkdJob), '3', 0)
#17 /vendor/laravel/framework/src/Illuminate/Queue/Worker.php(113): Illuminate\Queue\Worker->pop('beanstalkd', 'default', 0, '10', '3')
#18 /vendor/laravel/framework/src/Illuminate/Queue/Worker.php(85): Illuminate\Queue\Worker->runNextJobForDaemon('beanstalkd', 'default', 0, '10', '3')
#19 /vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Worker->daemon('beanstalkd', 'default', 0, 128, '10', '3')
#20 /vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(67): Illuminate\Queue\Console\WorkCommand->runWorker('beanstalkd', 'default', 0, 128, true)
#21 [internal function]: Illuminate\Queue\Console\WorkCommand->fire()
#22 /vendor/laravel/framework/src/Illuminate/Container/Container.php(523): call_user_func_array(Array, Array)
#23 /vendor/laravel/framework/src/Illuminate/Console/Command.php(115): Illuminate\Container\Container->call(Array)
#24 /vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /vendor/laravel/framework/src/Illuminate/Console/Command.php(101): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /vendor/symfony/console/Symfony/Component/Console/Application.php(874): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /vendor/symfony/console/Symfony/Component/Console/Application.php(126): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(94): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 /artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 {main} 

from twitter.

thujohn avatar thujohn commented on May 22, 2024

Can you try a route which returns a new Twitter object ?
dd(get_class(new \Twitter));

from twitter.

joedawson avatar joedawson commented on May 22, 2024

"Thujohn\Twitter\Facades\Twitter" on both local and production.

http://inkedfemales.com/test

from twitter.

thujohn avatar thujohn commented on May 22, 2024

And you are running the good command ? :)

from twitter.

joedawson avatar joedawson commented on May 22, 2024

Yep - everything is up to date on production. Just left work, when in in
home I'm going to just delete the site and install again.

Will let you know how that goes :)

On Friday, March 27, 2015, Jonathan Thuau [email protected] wrote:

And you are running the good command ? :)


Reply to this email directly or view it on GitHub
#74 (comment).

from twitter.

joedawson avatar joedawson commented on May 22, 2024

Hey @thujohn,

I managed to get my site up and working yesterday - thanks for the assistance :)

I have another odd issue where Laravel's route() helper is outputting a link to "http://localhost/" rather than my production domain (http://inkedfemales.com). But it only does it from my command.

I created a 'test' route and just did this:

$female = App\Female::first();

return Twitter::postTweet([
    'status' => route('females.show', $female->slug)
]);

That works perfectly, on local and production. But in my command, it does exactly the same thing but doesn't work in production. Is this related to the Twitter package?

from twitter.

thujohn avatar thujohn commented on May 22, 2024

I don't think this issue comes from my package because it doesn't modify router.

Maybe you have a cache for your routes.

from twitter.

joedawson avatar joedawson commented on May 22, 2024

Thanks @thujohn, will investigate this outside of this packages issues.

Appreciate your help. Consider this closed 👍

from twitter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.