bug(transport): using Debug pack resulting "datetime normalizer" error
I'm following the quick start guide, and it runs successfully
symfony console scheduler:list
[OK] 1 task found
+-------------+------+---------------------------+-------------+---------------------+---------------------------+-------------------------+-----------------------------+---------+------+
| Type | Name | Description | Expression | Last execution date | Next execution date | Last execution duration | Last execution memory usage | State | Tags |
+-------------+------+---------------------------+-------------+---------------------+---------------------------+-------------------------+-----------------------------+---------+------+
| CommandTask | foo | A simple cache clear task | */5 * * * * | Not executed | 2022-10-19T11:40:00+00:00 | Not tracked | Not tracked | enabled | |
+-------------+------+---------------------------+-------------+---------------------+---------------------------+-------------------------+-----------------------------+---------+------+
Then I installed the debug pack
composer require --dev debug
Once installed, I try again the list command it returned the error
symfony console scheduler:list
In Connection.php line 170:
The datetime normalizer is not an instance of Symfony\Component\Serializer\Normalizer\DateTimeNormalizer.
In TaskNormalizer.php line 82:
The datetime normalizer is not an instance of Symfony\Component\Serializer\Normalizer\DateTimeNormalizer.
Then I try to remove all Debug pack dependencies
composer remove symfony/debug-bundle symfony/web-profiler-bundle symfony/monolog-bundle
And then run back the list command, and it works again
symfony console scheduler:list
[OK] 1 task found
+-------------+------+---------------------------+-------------+---------------------+---------------------------+-------------------------+-----------------------------+---------+------+
| Type | Name | Description | Expression | Last execution date | Next execution date | Last execution duration | Last execution memory usage | State | Tags |
+-------------+------+---------------------------+-------------+---------------------+---------------------------+-------------------------+-----------------------------+---------+------+
| CommandTask | foo | A simple cache clear task | */5 * * * * | Not executed | 2022-10-19T11:40:00+00:00 | Not tracked | Not tracked | enabled | |
+-------------+------+---------------------------+-------------+---------------------+---------------------------+-------------------------+-----------------------------+---------+------+
Hi @suabahasa 👋🏻
Hum, weird, I'm going to investigate this one, it was fixed before but it seems unresolved, sorry for this issue.
Hi @suabahasa 👋🏻
Could you precise the version of the bundle and Symfony deps that you're using?
I tried locally using the latest version of the bundle and it seems to works as expected 🤔
Hi @Guikingone
I start a fresh install to reproduce the error.
- Install the symfony and package
symfony new jadwal
cd .\jadwal\
composer require --dev debug
composer require guikingone/scheduler-bundle
- Create a new config file
# config/packages/scheduler.yaml
scheduler_bundle:
transport:
dsn: 'filesystem://first_in_first_out'
tasks:
foo:
type: 'command'
command: 'cache:clear'
expression: '*/5 * * * *'
description: 'A simple cache clear task'
options:
env: test
- Clear the cache with
symfony console c:c
// Clearing the cache for the dev environment with debug true
[OK] Cache for the "dev" environment (debug=true) was successfully cleared.
- List the schedule with
symfony console scheduler:listand the error come
In TaskNormalizer.php line 82:
The datetime normalizer is not an instance of Symfony\Component\Serializer\Normalizer\DateTimeNormalizer.
This is the output when I run composer show command
dragonmantank/cron-expression v3.3.2 CRON for PHP: Calculate the next or previous run date and determine if ...
guikingone/scheduler-bundle 0.10.0 A Symfony bundle that allows to schedule and create repetitive tasks
monolog/monolog 3.2.0 Sends your logs to files, sockets, inboxes, databases and various web s...
psr/cache 3.0.0 Common interface for caching libraries
psr/container 2.0.2 Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher 1.0.0 Standard interfaces for event handling.
psr/log 3.0.0 Common interface for logging libraries
symfony/cache v6.1.5 Provides extended PSR-6, PSR-16 (and tags) implementations
symfony/cache-contracts v3.1.1 Generic abstractions related to caching
symfony/config v6.1.3 Helps you find, load, combine, autofill and validate configuration valu...
symfony/console v6.1.6 Eases the creation of beautiful and testable command line interfaces
symfony/debug-bundle v6.1.3 Provides a tight integration of the Symfony VarDumper component and the...
symfony/dependency-injection v6.1.5 Allows you to standardize and centralize the way objects are constructe...
symfony/deprecation-contracts v3.1.1 A generic function and convention to trigger deprecation notices
symfony/dotenv v6.1.0 Registers environment variables from a .env file
symfony/error-handler v6.1.6 Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher v6.1.0 Provides tools that allow your application components to communicate wi...
symfony/event-dispatcher-contracts v3.1.1 Generic abstractions related to dispatching event
symfony/filesystem v6.1.5 Provides basic utilities for the filesystem
symfony/finder v6.1.3 Finds files and directories via an intuitive fluent interface
symfony/flex v2.2.3 Composer plugin for Symfony
symfony/framework-bundle v6.1.6 Provides a tight integration between Symfony components and the Symfony...
symfony/http-foundation v6.1.6 Defines an object-oriented layer for the HTTP specification
symfony/http-kernel v6.1.6 Provides a structured process for converting a Request into a Response
symfony/lock v6.1.3 Creates and manages locks, a mechanism to provide exclusive access to a...
symfony/monolog-bridge v6.1.2 Provides integration for Monolog with various Symfony components
symfony/monolog-bundle v3.8.0 Symfony MonologBundle
symfony/options-resolver v6.1.0 Provides an improved replacement for the array_replace PHP function
symfony/polyfill-intl-grapheme v1.26.0 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-normalizer v1.26.0 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring v1.26.0 Symfony polyfill for the Mbstring extension
symfony/process v6.1.3 Executes commands in sub-processes
symfony/property-access v6.1.3 Provides functions to read and write from/to an object or array using a...
symfony/property-info v6.1.6 Extracts information about PHP class' properties using metadata of popu...
symfony/routing v6.1.5 Maps an HTTP request to a set of configuration variables
symfony/runtime v6.1.3 Enables decoupling PHP applications from global state
symfony/serializer v6.1.6 Handles serializing and deserializing data structures, including object...
symfony/service-contracts v3.1.1 Generic abstractions related to writing services
symfony/stopwatch v6.1.5 Provides a way to profile code
symfony/string v6.1.6 Provides an object-oriented API to strings and deals with bytes, UTF-8 ...
symfony/translation-contracts v3.1.1 Generic abstractions related to translation
symfony/twig-bridge v6.1.6 Provides integration for Twig with various Symfony components
symfony/twig-bundle v6.1.1 Provides a tight integration of Twig into the Symfony full-stack framework
symfony/var-dumper v6.1.6 Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter v6.1.3 Allows exporting any serializable PHP data structure to plain PHP code
symfony/web-profiler-bundle v6.1.6 Provides a development tool that gives detailed information about the e...
symfony/yaml v6.1.6 Loads and dumps YAML files
twig/twig v3.4.3 Twig, the flexible, fast, and secure template language for PHP
webmozart/assert 1.11.0 Assertions to validate method input/output with nice error messages.
I have upload the folder on https://www.dropbox.com/s/boyvl8hixlxylzv/jadwal.zip?dl=0
Hi @suabahasa 👋🏻
Sorry for the delay, could you share a reproducer via Github? I tried to reproduce it locally via a new project but I don't get the error listed earlier, it just "works as expected", the composer show list the same dependencies as yours and both c:c and scheduler:list works as expected 🤔
Hi @Guikingone
I have shared the reproducer via GitHub at https://github.com/suabahasa/jadwal. I include the vendor and var folders as well.
Thank you
Hi @suabahasa 👋🏻
Could you test if dev-issue/302 fix the issue? It seems to work locally but I prefer that you validate it against your project if you have time.
Hi @Guikingone
I want to confirm it does work. Thank you very much.
suabahasa ❯ composer require guikingone/scheduler-bundle:dev-issue/302
./composer.json has been updated
Running composer update guikingone/scheduler-bundle
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
- Upgrading guikingone/scheduler-bundle (0.10.0 => dev-issue/302 0252bd4)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Downloading guikingone/scheduler-bundle (dev-issue/302 0252bd4)
- Upgrading guikingone/scheduler-bundle (0.10.0 => dev-issue/302 0252bd4): Extracting archive
Generating optimized autoload files
43 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Run composer recipes at any time to see the status of your Symfony recipes.
Executing script cache:clear [OK]
Executing script assets:install public [OK]
No security vulnerability advisories found
suabahasa ❯ symfony console c:c
// Clearing the cache for the dev environment with debug true
[OK] Cache for the "dev" environment (debug=true) was successfully cleared.
suabahasa ❯ symfony console scheduler:list
[OK] 1 task found
+-------------+------+---------------------------+-------------+---------------------+---------------------------+-------------------------+-----------------------------+---------+------+
| Type | Name | Description | Expression | Last execution date | Next execution date | Last execution duration | Last execution memory usage | State | Tags |
+-------------+------+---------------------------+-------------+---------------------+---------------------------+-------------------------+-----------------------------+---------+------+
| CommandTask | foo | A simple cache clear task | */5 * * * * | Not executed | 2022-11-16T09:55:00+00:00 | Not tracked | Not tracked | enabled | |
+-------------+------+---------------------------+-------------+---------------------+---------------------------+-------------------------+-----------------------------+---------+------+
Thanks for the feedback, the fix will be released via 0.10.1 🙂
Sweet! Thank you @Guikingone