Home
Support Forums

Collaborative Deploy Previews not working on pages returned from function

The sidebar (Netlify Icon) for Collaborative Deploy Previews is not showing on most pages of our site (e.g. https://deploy-preview-1--stelvioforlife.netlify.app/). The site is a NextJS app, using the Essential NextJS Plugin. Because most pages are rendered from Netlify Functions, I believe the sidebar is not injected there. On a static page, such as the 404, the bar does appear (https://deploy-preview-1--stelvioforlife.netlify.app/does-not-exist).

Am I correct in assuming that HTML output from Netlify Functions is not taken into account for injecting the sidebar functionality?

Happy to help in any way to further debug this issue.

Hey there, @rmhartog :wave:

Sorry for the slow response here, we appreciate your patience! I followed the links you shared and do indeed see the Collaborative Deploy Preview drawer on the lefthand side.

Is this issue still occurring for you on your local machine? If so, please let me know and I will touch base with the team that works on Collaborative Deploy Previews.

Hey Hillary,

appreciate the response, and apologies for any confusion caused. I decided to temporarily get the Collaborative Deploy Preview working by manually adding a script (in this case in NextJS, I added the script in _document). I gleaned the code from looking at a ‘normal’ CDP page.

<div
    data-netlify-deploy-id={deployId}
    data-netlify-site-id={siteId}
    style={{ position: "fixed", left: 0, bottom: 0, zIndex: 2147483647 }}
>
    <script async="" src="https://netlify-cdp-loader.netlify.app/netlify.js"></script>
</div>

This causes the drawer to work properly, but I’m forced to include this manually. It would be nice (although I understand there might be a fair share of edge-cases) if this was injected in HTML returned from Netlify Functions automatically.