Staysignal Docs
  • Welcome
  • Quickstart
    • Quickstart Guide
    • How to Connect Stripe
    • How to Connect Slack
    • Publish your Staysignal widget
    • How to Customize Widget Follow-Ups
  • Integration Guides
    • Integrations Overview
    • Simple HTML/JS integration
    • NextJS integration (App Router)
    • React integration
    • WordPress/WooCommerce integration
    • Custom/Advanced Integration
    • Finding Stripe Subscription IDs
    • Troubleshooting & Error Handling
  • Billing
    • Managing your Staysignal subscription
  • Contact
    • How to Contact Staysignal Support
Powered by GitBook
On this page
  1. Integration Guides

Troubleshooting & Error Handling

Global JavaScript Error Handler

Add a global error handler to catch widget errors in the browser:

<script>
window.onerror = function(msg, url, line, col, error) {
    console.error('Widget error:', { msg, url, line, col, error });
    return false;
};
</script>

React Error Boundary Example

For React apps, use an error boundary to catch integration errors:

import React from 'react';

class ErrorBoundary extends React.Component {
  constructor(props) {
    super(props);
    this.state = { hasError: false };
  }
  static getDerivedStateFromError(error) {
    return { hasError: true };
  }
  componentDidCatch(error, errorInfo) {
    console.error('Widget integration error:', error, errorInfo);
  }
  render() {
    if (this.state.hasError) {
      return <h2>Something went wrong loading the widget.</h2>;
    }
    return this.props.children;
  }
}

Common Issues & Solutions

  • Widget not loading: Check browser console for errors. Ensure the script URL and Site ID are correct.

  • Subscription ID not found: Make sure your backend is passing the correct Stripe subscription ID to the frontend.

  • API errors: Check your server logs for error messages. Ensure your API keys and environment variables are set correctly.

  • Widget not appearing: Make sure the script is included after the DOM is loaded, and there are no JavaScript errors on the page.

If you encounter persistent issues, check your server logs and browser console, and contact support with error details.

Need Help?

If you encounter any issues with the integration, please contact our support team.

PreviousFinding Stripe Subscription IDsNextManaging your Staysignal subscription

Last updated 13 days ago