Find solutions to common issues with DatoCMS-powered websites, from performance optimization to tracking implementation problems.
Common Issue Categories
Performance Issues
Performance problems can significantly impact user experience and SEO rankings.
Largest Contentful Paint (LCP)
- Slow Imgix image loading
- GraphQL query performance
- Framework-specific rendering delays
- Target: Under 2.5 seconds
- Images without dimensions from DatoCMS
- Dynamic content shifting
- Font loading issues
- Target: Under 0.1
First Input Delay (FID) / INP
- JavaScript bundle size
- Framework hydration delays
- Third-party script blocking
Tracking Issues
Problems with analytics and conversion tracking implementation.
- GA4 events not tracked
- GTM data layer issues
- Meta Pixel not loading
- Missing DatoCMS metadata
Data Layer Problems
- Incorrect DatoCMS data structure
- Missing content fields
- Type mismatches
- Preview mode contamination
- Multi-locale tracking issues
- Subdomain configuration
- Referrer tracking problems
Content Issues
DatoCMS-specific content delivery problems.
GraphQL Query Errors
- Query syntax errors
- Missing fields
- Rate limiting
- API token issues
Image Loading Problems
- Imgix transformation errors
- Responsive images not working
- Blur placeholders failing
- WebP format issues
Preview Mode Issues
- Preview not showing latest content
- Preview contaminating analytics
- Authentication failures
- Real-time updates not working
Build and Deployment
Framework build and deployment issues.
Next.js Build Failures
- Static generation errors
- Image optimization failures
- GraphQL query errors at build time
- Environment variable issues
Gatsby Build Problems
- gatsby-source-datocms errors
- Out of memory errors
- GraphQL schema conflicts
- Image processing failures
ISR Issues
- Revalidation not working
- Stale content served
- On-demand revalidation failures
Quick Diagnostic Tools
Check DatoCMS API Status
# Test API connectivity
curl -X POST https://graphql.datocms.com/ \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"query": "{ _allContentTypesMeta { count } }"}'
Verify Image Optimization
Test Imgix image URLs:
https://www.datocms-assets.com/YOUR_PROJECT/image.jpg?w=800&auto=format
Debug GraphQL Queries
Use DatoCMS GraphQL Explorer:
- Go to DatoCMS Dashboard
- Settings → API Explorer
- Test your queries interactively
Check Performance Scores
Tools to diagnose performance:
- PageSpeed Insights
- WebPageTest
- Chrome DevTools Lighthouse
- GTmetrix
Verify Tracking
Debug tracking implementation:
- GA4: Use DebugView in Google Analytics
- GTM: Enable Preview mode
- Meta Pixel: Install Meta Pixel Helper extension
- Console: Check
window.dataLayerorwindow.fbq
Framework-Specific Issues
Next.js
Common Next.js + DatoCMS issues:
Build Errors
// Issue: GraphQL query fails at build time
// Solution: Add error handling
export async function getStaticProps() {
try {
const data = await fetchDatoCMSContent()
return { props: { data } }
} catch (error) {
console.error('DatoCMS fetch error:', error)
return { notFound: true }
}
}
Image Optimization
// Issue: Images from DatoCMS not optimizing
// Solution: Configure image loader
// next.config.js
module.exports = {
images: {
loader: 'custom',
loaderFile: './lib/datocms-image-loader.ts',
},
}
Gatsby
Source Plugin Errors
# Issue: gatsby-source-datocms failing
# Solution: Clear cache and rebuild
gatsby clean && gatsby build
Memory Issues
// gatsby-config.js
module.exports = {
plugins: [
{
resolve: 'gatsby-source-datocms',
options: {
apiToken: process.env.DATOCMS_API_TOKEN,
previewMode: false,
disableLiveReload: true, // Reduce memory usage
},
},
],
}
Environment-Specific Debugging
Development
Enable verbose logging:
// lib/datocms.ts
export async function fetchDatoCMS(query: string) {
if (process.env.NODE_ENV === 'development') {
console.log('DatoCMS Query:', query)
}
const response = await fetch('https://graphql.datocms.com/', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.DATOCMS_API_TOKEN}`,
},
body: JSON.stringify({ query }),
})
const data = await response.json()
if (process.env.NODE_ENV === 'development') {
console.log('DatoCMS Response:', data)
}
return data
}
Production
Monitor errors:
// Implement error tracking
export async function fetchDatoCMSWithTracking(query: string) {
try {
return await fetchDatoCMS(query)
} catch (error) {
// Send to error tracking service
if (typeof window !== 'undefined' && window.gtag) {
window.gtag('event', 'exception', {
description: 'DatoCMS API Error',
fatal: false,
})
}
throw error
}
}
Getting Help
DatoCMS Support
- Documentation: datocms.com/docs
- Community: DatoCMS Community
- Support: support@datocms.com
- Status Page: status.datocms.com
Framework Support
- Next.js: nextjs.org/docs
- Gatsby: gatsbyjs.com/docs
- React: react.dev
Analytics Support
- GA4: Google Analytics Help
- GTM: Tag Manager Help
- Meta: Meta Business Help
Troubleshooting Guides
By Topic
- LCP Optimization - Fix slow loading
- CLS Fixes - Prevent layout shifts
- Tracking Issues - Debug analytics
By Issue Type
Performance
- Slow GraphQL queries → LCP Guide
- Layout shifts → CLS Guide
- Large bundles → Optimize dependencies and code splitting
Tracking
- Missing events → Events Guide
- Wrong data → Check data layer configuration
- Privacy issues → Implement consent management
Content
- Query errors → Check API Explorer
- Missing images → Verify asset uploads
- Preview issues → Check authentication
Prevention Best Practices
- Testing: Test in development before production deploy
- Monitoring: Set up performance monitoring (Core Web Vitals)
- Error Tracking: Implement error logging (Sentry, LogRocket)
- Validation: Validate GraphQL queries before deployment
- Fallbacks: Implement graceful error handling