Describe the Bug
When running against the Sitecore Edge Preview Context, using any imageParams for the NextImage (as documented here) results in broken image URLs.
To Reproduce
- Add
imageParams to a NextImage
- Configure app to use your environment's preview context and run
Expected Behavior
Image renders properly
Possible Fix
The issue appears to stem from the fact that the preview media URLs use specific query parameters such as ttc, tt, and hash - which are stripped when run through updateImageUrl. Possible those parameters just need to be added to getRequiredParams. However, I'm guessing it's not that simple - since the hash is based on the original parameters, that hash would likely not work for any new parameters.
For example, when using the documented example, the resulting (failing) URL is:
https://xmc-<customer>.sitecorecloud.io/-/jssmedia/my/image.png?mw=100&mh=50
However, if you remove imageParams, the resulting (successful) URL is:
https://xmc-<customer>.sitecorecloud.io/-/jssmedia/my/image.png?h=423&iar=0&w=564&ttc=63908923158&tt=20634CFEEA2A98DD393960A582C5921A&hash=374DCBDC0C6EF657B922B08CF5E39C14
Provide environment information
- Sitecore Version: Sitecore AI
- Content SDK Version: 1.4.1
- Browser Name and version: N/A
- Operating System and version (desktop or mobile): N/A
- Link to your project (if available): N/A
Describe the Bug
When running against the Sitecore Edge Preview Context, using any
imageParamsfor theNextImage(as documented here) results in broken image URLs.To Reproduce
imageParamsto aNextImageExpected Behavior
Image renders properly
Possible Fix
The issue appears to stem from the fact that the preview media URLs use specific query parameters such as
ttc,tt, andhash- which are stripped when run through updateImageUrl. Possible those parameters just need to be added to getRequiredParams. However, I'm guessing it's not that simple - since thehashis based on the original parameters, that hash would likely not work for any new parameters.For example, when using the documented example, the resulting (failing) URL is:
https://xmc-<customer>.sitecorecloud.io/-/jssmedia/my/image.png?mw=100&mh=50However, if you remove
imageParams, the resulting (successful) URL is:https://xmc-<customer>.sitecorecloud.io/-/jssmedia/my/image.png?h=423&iar=0&w=564&ttc=63908923158&tt=20634CFEEA2A98DD393960A582C5921A&hash=374DCBDC0C6EF657B922B08CF5E39C14Provide environment information