Skip to content

fix: URL-encode function name in fetchFunctionLogs to fix 404 for zero-config functions#429

Closed
kfirstri wants to merge 6 commits intomainfrom
claude/issue-421-20260318-1317
Closed

fix: URL-encode function name in fetchFunctionLogs to fix 404 for zero-config functions#429
kfirstri wants to merge 6 commits intomainfrom
claude/issue-421-20260318-1317

Conversation

@kfirstri
Copy link
Collaborator

@kfirstri kfirstri commented Mar 18, 2026

Note

Description

This PR fixes a bug where fetching logs for zero-config functions with slashes in their names (e.g., stam/foo from functions/stam/foo/entry.ts) resulted in a 404 error. The function name was being interpolated directly into the URL path, causing the slash to be treated as a path separator by the server. The fix applies encodeURIComponent() to functionName in fetchFunctionLogs, consistent with how deploySingleFunction and deleteSingleFunction already handle this. The test server mocks are updated accordingly.

Related Issue

Fixes #421

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • Wrap functionName with encodeURIComponent() when building the URL in fetchFunctionLogs (packages/cli/src/core/resources/function/api.ts)
  • Update mockFunctionLogs and mockFunctionLogsError in TestAPIServer.ts to use encodeURIComponent(functionName) so mock routes match the encoded URLs
  • Brings fetchFunctionLogs in line with deploySingleFunction and deleteSingleFunction, which already apply this encoding

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (npm test)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated docs/ (AGENTS.md) if I made architectural changes

Additional Notes

The fix is minimal and consistent with the encoding pattern already used by deploySingleFunction and deleteSingleFunction in the same file. No documentation or architectural changes are needed.


🤖 Generated by Claude | 2026-03-19 14:30 UTC

Functions with slashes in their names (zero-config functions like
stam/foo from functions/stam/foo/entry.ts) were causing 404 errors
because the slash was interpreted as a path separator.

Co-authored-by: Kfir Stri <kfirstri@users.noreply.github.com>
@kfirstri kfirstri self-assigned this Mar 18, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.47-pr.429.4d0c680

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.0.47-pr.429.4d0c680"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.47-pr.429.4d0c680"
  }
}

Preview published to npm registry — try new features instantly!

@kfirstri
Copy link
Collaborator Author

https://github.com/base44-dev/apper/pull/5772 we need to merge this first

kfirstri added a commit that referenced this pull request Mar 19, 2026
…o-config functions (#429)

* fix: URL-encode function name in fetchFunctionLogs API call

Functions with slashes in their names (zero-config functions like
stam/foo from functions/stam/foo/entry.ts) were causing 404 errors
because the slash was interpreted as a path separator.

Co-authored-by: Kfir Stri <kfirstri@users.noreply.github.com>

* lint

* fix test server

---------

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Kfir Stri <kfirstri@users.noreply.github.com>
@kfirstri
Copy link
Collaborator Author

somehow this was merged but not closed..
image

@kfirstri kfirstri closed this Mar 19, 2026
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.

[Bug]: getting 404 when running the logs command and have a zero-config function

1 participant