Feature/cmg 774 - #1148
Closed
aishwarya-cstk wants to merge 2 commits into
Closed
Feature/cmg 774#1148aishwarya-cstk wants to merge 2 commits into
aishwarya-cstk wants to merge 2 commits into
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
Consider reviewing these vulnerabilities when fixes become available. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JIRA ticeket:
[https://contentstack.atlassian.net/browse/CMG-1114]
📋 PR Type
📝 Description
What changed?
Fixed
processFieldByType'sfileandreferencecases inapi/src/services/drupal/entries.service.ts.Added handling for values that are already resolved into asset/reference objects identified by a
.uid.Already-resolved objects are now passed through as-is instead of attempting to derive:
assets_${value}content_type_entries_title_${value}Applied the fix to both single-value and
multiplearray branches.Why?
Drupal image/file fields such as
field_image_target_idwere being resolved twice:processFieldDatacorrectly resolves the rawtarget_idinto a Contentstack asset reference object.processFieldByType'sfilecase, which assumes the value is still a raw numeric ID.assets_[object Object].As a result,
field_imageand other asset/reference fields resolved earlier in the migration pipeline were missing from the final migrated entry.Fix
The fix short-circuits processing when the value is already a resolved object containing a
.uid.This is additive and does not change the existing raw-ID flow, including:
GROUP_CONCATarraysThe fix also works correctly for delta re-runs because Drupal entries are fully re-fetched and re-processed on every migration run rather than incrementally patched.
🧩 Affected Areas
api— Node.js backendui— React frontendupload-api— Upload API serverdocker/docker-compose🧪 How to Test
Run a Drupal migration against a content type containing:
field_imageInspect the generated entry JSON under:
data/<stack_id>/entries/<content_type>/<locale>/<locale>.jsonConfirm that the image/file and reference fields are present in the generated entry.
Verify that the fields contain valid Contentstack
uidreferences.Re-run the same migration as a second iteration/delta run.
Confirm that the fields remain present and correctly resolved after the second run.
Verify that no
"Asset ... not found or invalid, removing field"errors are logged for valid assets.Expected Result
field_imageand other asset/reference fields should:"Asset ... not found or invalid, removing field"errors for valid assets.📸 Screenshots / Recordings
🔗 Related PRs / Dependencies
✅ Author Checklist
feature/,bugfix/, orhotfix/+ 5–30 lowercase characters.env/example.envupdated if new environment variables were addednpm test)README.md/ documentation updated if behavior changed👀 Reviewer Notes
The guard relies on the presence of
.uidto identify an already-resolved asset/reference object.The
.uidfield is always set when asset references are constructed inapi/src/services/drupal/assets.service.ts.Please flag if there is any known resolved-object shape that does not contain
.uid.No automated test was added directly to the existing test suite because
api/src/services/drupalcurrently does not have field-processing unit tests to extend.The fix was manually verified using a standalone script covering both:
A Vitest unit test for
processFieldByTypecan be added if required.