Skip to content

fix: correct _allowed_origins typo to allowed_cors_origins in CORS middleware (closes #2083) - #2087

Merged
riteshbonthalakoti merged 1 commit into
riteshbonthalakoti:gssocfrom
namann5:fix/cors-allowed-origins-nameerror
Jun 7, 2026
Merged

fix: correct _allowed_origins typo to allowed_cors_origins in CORS middleware (closes #2083)#2087
riteshbonthalakoti merged 1 commit into
riteshbonthalakoti:gssocfrom
namann5:fix/cors-allowed-origins-nameerror

Conversation

@namann5

@namann5 namann5 commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes a critical NameError at server startup that crashes the entire API.

The Bug

backend/main.py:1600 defines allowed_cors_origins = get_allowed_origins() but backend/main.py:1605 references _allowed_origins (note the underscore prefix), which was never defined.

When the server starts, FastAPI evaluates the CORS middleware configuration and throws:

NameError: name '_allowed_origins' is not defined

This crashes the server before any endpoint can respond.

Fix

One character fix: _allowed_originsallowed_cors_origins on line 1605.

Closes #2083

…ddleware (closes riteshbonthalakoti#2083)

Line 1600 defines allowed_cors_origins = get_allowed_origins() but line 1605
references _allowed_origins (underscore prefix), which was never defined.
This causes a NameError at server startup, crashing the entire API.

Fix: rename _allowed_origins to allowed_cors_origins on line 1605.
@vercel

vercel Bot commented Jun 7, 2026

Copy link
Copy Markdown

@namann5 is attempting to deploy a commit to the ritesh Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 211bbecd-458e-4b13-a535-54829e4727fb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@riteshbonthalakoti riteshbonthalakoti added gssoc GirlScript Summer of Code gssoc:approved GSSoC Approved PR level:critical Critical level difficulty quality:exceptional Exceptional code quality type:security Security fix or improvement labels Jun 7, 2026
@riteshbonthalakoti

Copy link
Copy Markdown
Owner

Superb implementation, @namann5! I've successfully resolved all conflicts in your PR and queued it for merging into gssoc.

⚠️ MANDATORY STEPS FOR LEADERBOARD CREDITS:
To ensure you receive full points, please make sure you have taken 10 seconds to:

Keep up the outstanding work! Let's build together! 🔥

@riteshbonthalakoti
riteshbonthalakoti merged commit e488dba into riteshbonthalakoti:gssoc Jun 7, 2026
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC Approved PR gssoc GirlScript Summer of Code level:critical Critical level difficulty quality:exceptional Exceptional code quality type:security Security fix or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants