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

Startup Error: ENV misconfig #2378

Merged
merged 3 commits into from
Jan 16, 2025
Merged

Conversation

0xSero
Copy link
Contributor

@0xSero 0xSero commented Jan 16, 2025

Relates to

No specific issue ticket.

Risks

Low - This is a minor validation improvement that makes the URL check more robust.

Background

What does this PR do?

Character start fails due to lack of a env
Improves the URL validation check in the hasValidRemoteUrls() function to be more stable by ensuring URLs start with "http" rather than just checking for non-empty strings.

image

What kind of change is this?

Bug fixes (non-breaking change which fixes an issue)

Documentation changes needed?

My changes do not require a change to the project documentation.

Testing

Where should a reviewer start?

Look at the hasValidRemoteUrls() function in agent/src/index.ts:

// Before:
const hasValidRemoteUrls = () =>
    process.env.REMOTE_CHARACTER_URLS &&
    process.env.REMOTE_CHARACTER_URLS !== "";

// After:
const hasValidRemoteUrls = () =>
    process.env.REMOTE_CHARACTER_URLS &&
    process.env.REMOTE_CHARACTER_URLS !== "" &&
    process.env.REMOTE_CHARACTER_URLS.startsWith("http");

Detailed testing steps

  1. Set REMOTE_CHARACTER_URLS environment variable to various values:
    • Valid URL: http://example.com - should return true
    • Invalid URL: not-a-url - should return false
    • Empty string: "" - should return false
    • Undefined - should return false

Discord username

0xsero

@0xSero 0xSero changed the title fix Startup Error: ENV misconfig Jan 16, 2025
@wtfsayo
Copy link
Member

wtfsayo commented Jan 16, 2025

thanks got this covered in #2384 pretty close

@wtfsayo wtfsayo closed this Jan 16, 2025
@wtfsayo wtfsayo reopened this Jan 16, 2025
@wtfsayo wtfsayo self-requested a review January 16, 2025 13:48
@wtfsayo wtfsayo merged commit 984bb33 into elizaOS:develop Jan 16, 2025
3 checks passed
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