Raistlfiren / garmin-csv-plan

A quick n' dirty way of "automating" training plans into Garmin Connect.
https://raistlfiren.github.io/garmin-csv-plan/
37 stars 6 forks source link

GarminHelper.php -- Undefined property: stdClass::$workoutId when using CSV from tests folder #28

Closed sedonaprice closed 4 months ago

sedonaprice commented 5 months ago

When testing the syntax/functionality of this package using the csv file in the tests folder here: https://github.com/Raistlfiren/garmin-csv-plan/blob/master/tests/Resource/multi-events-day.csv, the following error occurred:

Command: bin/console garmin:workout multi-events-day.csv import

Output:

Starting workout import/export command
======================================

Validating and accessing - multi-events-day.csv
-----------------------------------------------

 [OK] File valid                                                                                                        

Parsing Workouts
----------------

 * 10x30''30''
 * easy cycle
 * easy run
 * long run

 Does the following look correct? (yes/no) [yes]:
 > yes

Creating workouts
-----------------

[critical] Error thrown while running command "garmin:workout 'multi-events-day.csv' import". Message: "Warning: Undefined property: stdClass::$workoutId"

In GarminHelper.php line 69:

  Warning: Undefined property: stdClass::$workoutId  

Software / system versions: OS: MacOS 13.6.3

php --version

PHP 8.3.7 (cli) (built: May  7 2024 16:35:26) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.7, Copyright (c), by Zend Technologies

If rolling back to an older PHP version would fix the issue, happy to do that to use this amazing package!

Raistlfiren commented 5 months ago

Hey @sedonaprice - Thank you so much for reporting this detailed issue. This is a problem with the latest version of PHP 8.3. It is only compatible with 8.1 at this moment. I will update it to PHP 8.3 once the CloudFlare issue is resolved.

That all being said, I think there is still a problem with connecting to Garmin Connect and getting an authentication token. Garmin started using CloudFlare and it is causing issues with the login process.

sedonaprice commented 5 months ago

Thanks, I'll try to roll back to PHP=8.1!

I will note that I don't think I had an authentication problem with PHP=8.3, as it ran happily until this point when I correctly configured username/password, vs a "cannot connect" error when I had correctly set those up!

mmazerolle commented 4 months ago

Seeing the same error running in docker, which seems to have 8.1-cli. I do not have php installed locally.

Hope this is helpful in tracking this down, and looking forward to a fix or workaround. Anything I can do to provide more info with my docker env hitting this one?

maz@Mathieus-Air garmin-csv-plan-master % docker-compose run garmin ./bin/console garmin:workout pfitz.csv schedule -s '2024-10-06' -r 'Pfitz: '
WARN[0000] /Users/maz/garmin-csv-plan/garmin-csv-plan-master/docker-compose.yaml: `version` is obsolete 

Starting workout import/export command
======================================

Validating and accessing - pfitz.csv
------------------------------------

 [OK] File valid                                                                                                    

Parsing Workouts
----------------

 * 14k, 6k @ LT
 * 18k long run
 * 8k recovery
 * 14k easy
 * 24k long run
 * 14k, 10 strides
 * 25k, 13k @ mp
 * 21k long run
 * 23k long run
 * 28k long run
 * 14k, 8k @ LT
 * 29k, 16k @ mp
 * 13k, 3x1600 intervals
 * 16k, 8k @ LT
 * 11k, 10 strides
 * 34k long run
 * 16k double
 * 17k, 9k @ LT
 * 10k recovery
 * 11k, 6 strides
 * 25k, 19k @ mp
 * 14k, 6x800 intervals
 * 19k, 11k @ LT
 * 14k, 5x600 intervals
 * 10k tune-up race
 * 30k, 22k @ mp
 * 18k, 5x1200 intervals
 * 11k, 8 strides
 * 8k, 6 strides
 * 6k recovery
 * 11k, 3k @ mp

 Does the following look correct? (yes/no) [yes]:
 > yes

Creating workouts
-----------------

[critical] Error thrown while running command "garmin:workout 'pfitz.csv' schedule -s 2024-10-06 -r 'Pfitz: '". Message: "Warning: Undefined property: stdClass::$workoutId"

In GarminHelper.php line 69:

  Warning: Undefined property: stdClass::$workoutId  

garmin:workout [-m|--email EMAIL] [-p|--password PASSWORD] [-x|--delete] [-X|--delete-only] [--dry-run] [-r|--prefix [PREFIX]] [--pool-size [POOL-SIZE]] [-s|--start START] [-d|--end END] [--] <csv> [<type>]

2024-05-28T22:16:50+00:00 [info] Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated
maz@Mathieus-Air garmin-csv-plan-master % ls
README.md       composer.json       docker          phpcs.xml.dist      src
_config.yml     config          docker-compose.yaml phpunit.xml.dist    symfony.lock
bin         doc         pfitz.csv       public          tests
`
Raistlfiren commented 4 months ago

Hi all,

I am pretty sure this is still broken due to issue #27. I updated the release to be compatible with PHP 8.3, and this shouldn't be an issue. Maybe one day it won't be broken! lol

mmazerolle commented 4 months ago

This is now resolved for me with 0.5 - thank you! Logging a further issue that is preventing import and scheduling however.

Raistlfiren commented 4 months ago

Hi, authentication to Garmin should be resolved. Please test it out and see if it works for you. I have not created a release or tagged it yet.

mmazerolle commented 3 months ago

Confirmed working. Well done, and thank you!