geoff-maddock / events-tracker

CRM and calendar to track events, weekly and monthly series, promoters, artists, producers, djs, venues and other entities.
https://arcane.city
MIT License
15 stars 5 forks source link

Daily Event Tweet - bug? #1074

Open geoff-maddock opened 1 year ago

geoff-maddock commented 1 year ago

[2023-05-12 07:00:05] local.ERROR: You must supply a readable file {"exception":"[object] (InvalidArgumentException(code: 0): You must supply a readable file at /var/www/events-tracker/vendor/abraham/twitteroauth/src/TwitterOAuth.php:343)

geoff-maddock commented 1 year ago

This code is checking if the 'media' file is readable and if it can get the file contents.
Need to confirm what the path is. This should work because it works with the manual run, but maybe there's something in the command environment that is missing?

Seems like it must have to do with the path where the primary photo is stored by EventPublished::toTwitter in order to make it uploadable to twitter:

    /**
     * @param Notifiable $notifiable
     */

    /** @phpstan-ignore-next-line */
    public function toTwitter($notifiable): TwitterStatusUpdate
    {
        if ($photo = $notifiable->getPrimaryPhoto()) {
            // copy the file to local
            $temp = Storage::disk('external')->get($photo->getTwitterPath());
            $public = Storage::disk('public');
            $public->put('./photos/temp/'.$photo->name, $temp);

            return (new TwitterStatusUpdate($notifiable->getBriefFormat()))->withImage('storage/photos/temp/'.$photo->name);
        }

        return new TwitterStatusUpdate($notifiable->getBriefFormat());
    }

Why would this be different in a command than when run from an HTTP route handler?

geoff-maddock commented 1 year ago

This is not going to work currently because my Twitter API account is suspended.