-
Notifications
You must be signed in to change notification settings - Fork 2
fix: production CORS 401, guarded bindSupabase, prod WISP_SECRET #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,8 +10,13 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => { | |
| const [loading, setLoading] = useState(true); | ||
|
|
||
| useEffect(() => { | ||
| // Bind Supabase auth state to Wisp analytics identity | ||
| const unsubscribeWisp = bindSupabase(supabase); | ||
| // Bind Supabase auth state to Wisp analytics identity (no-op if wisp not initialized) | ||
| let unsubscribeWisp = () => {}; | ||
| try { | ||
| unsubscribeWisp = bindSupabase(supabase); | ||
| } catch { | ||
| // wisp not initialized — skip analytics identity binding | ||
|
Comment on lines
+17
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The empty catch block swallows any error thrown by |
||
| } | ||
|
|
||
| // Set up auth state listener FIRST | ||
| const { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Access-Control-Allow-MethodsandAccess-Control-Allow-Headersare only inspected by browsers on preflight (OPTIONS) responses; they have no effect on the actualPOST401 reply. OnlyAccess-Control-Allow-Originis needed here to let the browser read the response body. The extra headers are harmless, but they're dead weight on every unauthorized request.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!