feed-me icon indicating copy to clipboard operation
feed-me copied to clipboard

Feed data differs in debug mode

Open Furo42 opened this issue 8 months ago • 1 comments

Description

We use the event “Fields::EVENT_AFTER_PARSE_FIELD”.

Depending on whether the import process is executed in debug mode, the structure of the $feedData variable differs considerably.

In normal mode, the structure is quite useless for us: Image

In debug mode, the values are output correctly in arrays Image

Steps to reproduce

  1. insert the event Fields::EVENT_AFTER_PARSE_FIELD
  2. set a breakpoint at this breakpoint
  3. perform an import with “Run Feed” in the backend and examine the variable $event->feedData at the breakpoint
  4. execute the same mode in debug mode, also examine the variable $event-feedData at the breakpoint

Additional info

  • Craft version: 5.7.4
  • PHP version: 8.2.28
  • Database driver & version: MySQL 8.0.40
  • Plugins & versions: Asset Usage 4.1.3 CKEditor 4.7.0 CleanTalk 1.1.0 Feed Me 6.8.0 Freeform 5.10.7 Navigation 3.0.6 SEO 5.0.0 Translations v4.0.7 Vite 5.0.1

Furo42 avatar Apr 30 '25 13:04 Furo42

I encountered this issue too.

Debug mode doesn't work when importing Table fields. It seems like debug mode parses sub-level data differently, as we can see in @Furo42 's screenshot.

I don't think using Events has any effect on this issue.

ymilin avatar May 27 '25 08:05 ymilin

Hi, thanks for reporting!

The feed data with a one-dimensional array (with flattened keys) is what you should see in both cases, as that’s what Feed Me knows how to process. This was the case until 5.10.0 and 6.7.0. The introduction of the batched job to Feed Me (in 5.11.0 and 6.8.0) accidentally skipped flattening the data when running feed via the debug option.

I raised a PR that ensures the feed data is properly flattened in both cases.

i-just avatar Aug 13 '25 10:08 i-just

Thanks! This fix has been released on Feed Me 5.13.0 and 6.10.0.

angrybrad avatar Aug 15 '25 22:08 angrybrad

@i-just @angrybrad Sorry to write here again, but unfortunately this adjustment is not quite what I had hoped for.

We use the “AFTER_PARSE_FIELD” event very intensively to fill fields that cannot be implemented with FeedMe standard functions.

For example, the import file contains fields with subarrays that we have to iterate through to import the correct value.

With the flat structure, we first have to rebuild an array from it, which seems very cumbersome.

How is this supposed to work? Or are we using the wrong event here?

Furo42 avatar Aug 22 '25 10:08 Furo42