Skip to content

fix: resolve ENOENT in home - #3141

Draft
oneuptime-test[bot] wants to merge 1 commit into
masterfrom
oneuptime-fix-exception-f72df8bb
Draft

fix: resolve ENOENT in home#3141
oneuptime-test[bot] wants to merge 1 commit into
masterfrom
oneuptime-fix-exception-f72df8bb

Conversation

@oneuptime-test

Copy link
Copy Markdown

Exception Fix

This pull request was automatically generated by OneUptime AI Agent to fix an exception.

Exception Details

Service: home
Type: ENOENT
Message (dynamic values and secrets redacted): ENOENT: no such file or directory, open '/usr/src/blog/posts/-redis-sliding-window-rate-limiting/README.md'

Stack Trace

Error: ENOENT: no such file or directory, open '/usr/src/blog/posts/<DATE>-redis-sliding-window-rate-limiting/README.md'

Summary of Changes

The pattern of using LocalFile.doesFileExist before LocalFile.read is already established elsewhere in the same file (lines 770, 814, 817), confirming this is the correct approach.

Summary of the fix:

  • Root cause: In Home/Utils/BlogPost.ts, the getBlogPostFromFile method attempted to read a blog post's README.md file without first checking if it existed. When a blog post entry was listed in Blogs.json but the actual README.md file didn't exist on disk (e.g., posts/<DATE>-redis-sliding-window-rate-limiting/README.md), LocalFile.read threw an ENOENT error.

  • Fix: Added a guard clause before the file read that checks LocalFile.doesFileExist(filePath) and returns null early if the file doesn't exist. This is consistent with:

    1. The method's declared return type (Promise<BlogPost | null>)
    2. The existing pattern in getBlogPost which catches exceptions and returns null
    3. The same guard pattern already used elsewhere in this file (lines 770, 814, 817)

Opened as a draft — review before merging. The fix is AI-authored: verify it actually addresses the exception, then mark the pull request ready for review. Nothing is merged automatically.

This PR was automatically generated by OneUptime AI Agent

ℹ️ Verification

Not verified — the repository has no setup/build/test commands configured. Configure them on the code repository to have fixes verified before the pull request opens.

This commit fixes an exception detected by OneUptime.

Exception Type: ENOENT
Exception ID: 790c32aa-3a08-40d6-9bdc-f24ea5e67c88

Automatically generated by OneUptime AI Agent.
@simlarsen

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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.

1 participant