Skip to content
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

chore: Add log when info.json is unavailable at specified path #33293

Open
wants to merge 3 commits into
base: release
Choose a base branch
from

Conversation

abhvsn
Copy link
Contributor

@abhvsn abhvsn commented May 8, 2024

No description provided.

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label May 8, 2024
Copy link
Contributor

coderabbitai bot commented May 8, 2024

Walkthrough

Walkthrough

This update enhances error reporting in the ProjectProperties.java file by adding a new log message. The change focuses on handling scenarios where the info.json file is not found, improving the clarity of error messaging within the application.

Changes

File Path Change Summary
.../ProjectProperties.java Added log message for missing info.json file. Updated constructor.

Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 42dec75 and 0172759.
Files selected for processing (1)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/ProjectProperties.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/ProjectProperties.java

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@abhvsn abhvsn requested a review from trishaanand May 8, 2024 11:50
}
} catch (IOException e) {
// Ignore the exception and return "UNKNOWN" as the version
log.debug("Error reading version from info.json {}", e.getMessage());
log.error("Error reading version from info.json {}", e.getMessage(), e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I'd recommend not adding , e to this. It'll print the whole stack trace and I don't think that'll give you more information than what e.getMessage() would.
  2. I'd also recommend removing the if check, instead of adding an else. If the file isn't there, let it throw an error and we're catching IOException anyway. In fact, I'd rather the backend not start at all if info.json is missing, but that makes local dev less convenient.

By the way, the entrypoint.sh already has a hard-check to fail if the info.json file is missing.

tr '\n' ' ' < /opt/appsmith/info.json

Copy link
Contributor Author

@abhvsn abhvsn May 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sharat87 if we already have the check in place for info.json then do you think there is a scenario where version does not get populated. I'm asking this because in license check call in EE we refer to the same variable https://github.com/appsmithorg/appsmith-ee/blob/5aa31d0e6162c55a13a79072f33cfd4df24cdc61/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/BaseLicenseAPIManagerImpl.java#L29. For some reason we have seen that version is communicated as UNKNOWN which is a default value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend not adding , e to this. It'll print the whole stack trace and I don't think that'll give you more information than what e.getMessage() would.

@sharat87 currently this only prints the info.json path nothing around what failed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps the license check is happening before the JSON file is read? Is there a possibility of a race condition here? If we can make the dependency explicit, then that question will go away too.

Other than that, I don't see why this file should be missing or invalid.

Copy link

github-actions bot commented May 9, 2024

Failed server tests

  • com.appsmith.server.services.ce.ApplicationServiceCETest#reuseDeletedAppName

@abhvsn abhvsn requested a review from sharat87 May 9, 2024 09:13
Copy link

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog Adding this label to a PR prevents it from being listed in the changelog Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants