Grafana iframe - templating init failed

Team,

We are trying to render grafana snapshot using an iframe for a dasboard which we are developing. We are able to generate the snapshot for a given panel using snapshotapi and while rendering the snapshot url in an iframe, we are getting "Template init failed Datasource named “x” was not found. However, if we are loading it directly in a browser, we are able to see the snap shot getting rendered. Any leads on this would be highly appreciated!

Thanks,
Deepak