Skip to content

fix:prevent null/empty headers from being sent in function execution #2127

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

Merged

Conversation

HarshMN2345
Copy link
Member

Fix: Prevent Null/Empty Headers in Function Execution

Problem

  • When creating a function execution without headers, the frontend could send a headers object like {null: ""} to the backend.
  • This is not expected behavior and could cause backend errors.
  • Initializing the headers array as an empty array caused runtime errors (e.g., TypeError: Cannot read properties of undefined (reading '0')) in the function execution modal UI.

Solution

  • The headers array is now always initialized as [['', '']], ensuring the UI has at least one empty entry and avoiding undefined errors.
  • When building the headers object for submission, only key-value pairs with a non-empty, non-whitespace key are included.
  • Reactive statements which rely on the headers array now properly guard against undefined, preventing further runtime errors.

Impact

  • The backend will receive only valid header key-value pairs, or an empty object if no headers are set.
  • No more {null: ""} or {"": ""} headers sent to the backend.
  • Eliminates runtime errors in the function execution modal.
  • Users can now submit function executions safely with or without custom headers.

Closes: SER-114

After

image

Before

image

Have you read the Contributing Guidelines on issues?

yes

@HarshMN2345 HarshMN2345 self-assigned this Jul 17, 2025
@ItzNotABug ItzNotABug merged commit 4fbbcdc into appwrite:main Jul 17, 2025
2 checks passed
@HarshMN2345 HarshMN2345 deleted the fix-SER-114-add-null-header-issue branch July 21, 2025 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants