Quick Fix for "ApololioError" in Intercom Clone Chatbot Tutorial: Creating Chatbot
First off, a huge shoutout to Sonny for the Intercom Clone tutorial — it's incredibly insightful and instrumental! Following the tutorial while implementating, I encountered the same snag at the 1:48:35; the "ApololioError." Despite closely following the tutorial steps, this error was persistent. After some digging, I realized the cause was a missing piece in the GraphQL mutation setup: the created_at parameter. Here’s a quick fix for those who might be facing the same issue: 1. Update Your GraphQL Mutation: Ensure your mutation includes the created_at field to track when each chatbot is created. Amend your GraphQL mutation in //graphql/mutations/mutations.ts like so: import { gql } from "@apollo/client"; export const CREATE_CHATBOT = gql` mutation CreateChatbot($clerk_user_id: String!, $name: String!, $created_at: DateTime!) { insertChatbots(clerk_user_id: $clerk_user_id, name: $name, created_at: $created_at) { id name } } `; 2. Correctly Pass the Date in Your Frontend: In your React component where the mutation is called (e.g., //app/(admin)/create-chatbot/page.tsx), ensure you pass the current date and time as follows: const [createChatbot, { data, loading, error }] = useMutation( CREATE_CHATBOT, { variables: { clerk_user_id: user?.id, name: name, created_at: new Date().toISOString(), // Dynamically set current date and time }, } ); With these tweaks, the "ApololioError" was resolved for me. I hope this solution helps anyone stuck at the same spot—happy coding!😎