Skip to content

fix: resolve ENOENT in home - #3140

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

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

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/-how-to-build-a-shared-augmented-reality-experience-with-azure-spatial-anchors-and-unity/README.md'

Stack Trace

Error: ENOENT: no such file or directory, open '/usr/src/blog/posts/<DATE>-how-to-build-a-shared-augmented-reality-experience-with-azure-spatial-anchors-and-unity/README.md'

Summary of Changes

The fix is complete. Let me provide a summary.

Summary

Root Cause: The getBlogPostFromFile method in Home/Utils/BlogPost.ts attempts to read a blog post's README.md file without first checking if the file exists. When a blog post entry in Blogs.json references a post directory that doesn't exist on disk (e.g., <DATE>-how-to-build-a-shared-augmented-reality-experience-with-azure-spatial-anchors-and-unity where <DATE> is a literal placeholder), LocalFile.read() throws an ENOENT error.

Fix: Added a file existence check before attempting to read the file in the getBlogPostFromFile method. If the README.md file doesn't exist, the method returns null early, which is already a valid return type for this method (Promise<BlogPost | null>).

Change made in Home/Utils/BlogPost.ts:

// Before line 320 (the file read):
// Skip posts whose README.md does not exist on disk (e.g. entries in
// Blogs.json that reference a post folder that has not been created yet).
if (!(await LocalFile.doesFileExist(filePath))) {
  return null;
}

This fix:

  • Uses the existing LocalFile.doesFileExist() utility already used elsewhere in the codebase
  • Returns null which is already handled gracefully by the calling getBlogPost method
  • Is minimal and focused — only 5 lines added
  • Follows existing code patterns and style

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: f9bbb9df-0353-41d0-a21c-60cea9cba7cd

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