@@ -12,64 +12,18 @@ export async function submitSupportFeedback(
1212 data : FeedbackData ,
1313) : Promise < { success : true } | { error : string } > {
1414 try {
15- // Enhanced logging for production debugging
16- console . log ( "🔍 Debug - Feedback submission attempt:" , {
17- hasSupabase : ! ! supabase ,
18- data : data ,
19- env : {
20- hasUrl : ! ! process . env . NEXT_PUBLIC_SUPABASE_URL ,
21- hasKey : ! ! process . env . NEXT_PUBLIC_SUPABASE_ANON_KEY ,
22- urlLength : process . env . NEXT_PUBLIC_SUPABASE_URL ?. length || 0 ,
23- keyLength : process . env . NEXT_PUBLIC_SUPABASE_ANON_KEY ?. length || 0 ,
24- } ,
25- timestamp : new Date ( ) . toISOString ( ) ,
26- } ) ;
27-
2815 if ( ! supabase ) {
2916 const error =
3017 "Supabase client not initialized. Please check your environment variables." ;
3118 console . error ( "❌ Supabase client error:" , error ) ;
3219 throw new Error ( error ) ;
3320 }
3421
35- // Test the connection first with more detailed logging
36- console . log ( "🔍 Testing Supabase connection..." ) ;
37- const { data : testData , error : testError } = await supabase
38- . from ( "support_feedback" )
39- . select ( "id" )
40- . limit ( 1 ) ;
41-
42- console . log ( "🔍 Debug - Supabase connection test:" , {
43- testData,
44- testError,
45- hasTestData : ! ! testData ,
46- testDataLength : testData ?. length || 0 ,
47- } ) ;
48-
49- if ( testError ) {
50- console . error ( "❌ Supabase connection test failed:" , testError ) ;
51- return { error : `Connection test failed: ${ testError . message } ` } ;
52- }
53-
54- // Attempt to insert the feedback
55- console . log ( "🔍 Attempting to insert feedback data:" , {
22+ // Insert the feedback
23+ const { error } = await supabase . from ( "support_feedback" ) . insert ( {
5624 rating : data . rating ,
57- feedbackLength : data . feedback ?. length || 0 ,
58- ticketId : data . ticketId ,
59- } ) ;
60-
61- const { data : insertData , error } = await supabase
62- . from ( "support_feedback" )
63- . insert ( {
64- rating : data . rating ,
65- feedback : data . feedback ,
66- ticket_id : data . ticketId ,
67- } ) ;
68-
69- console . log ( "🔍 Debug - Insert result:" , {
70- insertData,
71- error,
72- hasInsertData : ! ! insertData ,
25+ feedback : data . feedback ,
26+ ticket_id : data . ticketId ,
7327 } ) ;
7428
7529 if ( error ) {
@@ -82,7 +36,6 @@ export async function submitSupportFeedback(
8236 return { error : `Failed to submit feedback: ${ error . message } ` } ;
8337 }
8438
85- console . log ( "✅ Feedback submitted successfully:" , insertData ) ;
8639 return { success : true } ;
8740 } catch ( error ) {
8841 console . error ( "❌ Feedback submission error:" , {
0 commit comments