eliza icon indicating copy to clipboard operation
eliza copied to clipboard

fix: Goat Plugin + AWS S3 Service error when env vars absent

Open jnaulty opened this issue 10 months ago • 5 comments

Relates to:

https://github.com/ai16z/eliza/pull/941 and https://github.com/ai16z/eliza/pull/898

Errors when running agent were: TypeError: Cannot read properties of null (reading 'getChain')


 ["✓ Service video initialized successfully"] 

Initializing AwsS3Service
 ⛔ ERRORS
   Failed to initialize service aws_s3: 
   {} 

 ⛔ ERRORS
   Error starting agent for character trump: 
   {} 

Error: Missing required AWS credentials in environment variables
    at _AwsS3Service.initialize (file:///home/jnaulty/github.com/ai16z/eliza/packages/plugin-node/dist/index.js:1890:19)
    at AgentRuntime.initialize (file:///home/jnaulty/github.com/ai16z/eliza/packages/core/dist/index.js:3245:31)
    at async startAgent (file:///home/jnaulty/github.com/ai16z/eliza/agent/src/index.ts:344:9)
    at async startAgents (file:///home/jnaulty/github.com/ai16z/eliza/agent/src/index.ts:368:13)
 ⛔ ERRORS
   Error starting agents: 
   {} 

 ["◎ Chat started. Type 'exit' to quit."] 

You:  ["✓ Server running at http://localhost:3000/"] 

Risks

  • none, improves usability when specific env variables are not present

Background

What does this PR do?

  • fixes issue when environment variables are not set for goat + node plugins

What kind of change is this?

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

Why are we doing this? Any context or related work?

  • main branch does not run unless AWS env variables are set and Alchemy API (for GOAT)
    • NodePlugin is now only created when all required AWS credentials are present (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, AWS_S3_BUCKET)
  • GoatPlugin is now only created when ALCHEMY_API_KEY is present
  • Added type annotations for plugins to handle undefined cases

These changes prevent unnecessary plugin initialization when required credentials are missing and improve type safety.

Issues introduced in: https://github.com/ai16z/eliza/pull/941 and https://github.com/ai16z/eliza/pull/898

Documentation changes needed?

none

Testing

Where should a reviewer start?

Detailed testing steps

None, automated tests are fine.

Discord username

@crypto__john

jnaulty avatar Dec 11 '24 06:12 jnaulty