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

fix(dependencies): update requirements and OCPP compatibility #161

Merged
merged 2 commits into from
Feb 28, 2025

Conversation

pabloariasmora
Copy link
Contributor

  • feat: specify exact package versions in requirements.txt per AWS MWAA best practices
  • fix: restrict websockets to <14.0 due to OCPP v2.0.0 compatibility
  • refactor: rename RegistrationStatusType to RegistrationStatusEnumType
  • refactor: replace deprecated BootNotificationPayload with BootNotification
  • refactor: replace deprecated HeartbeatPayload with Heartbeat()

Ref:
https://aws.amazon.com/blogs/big-data/amazon-mwaa-best-practices-for-managing-python-dependencies/ mobilityhouse/ocpp#709

*Issue #, #153

Description of changes:

I have identified and fixed the root cause of the WebSocket Error 1011. The issue stems from multiple compatibility and dependency management challenges:

  1. OCPP Protocol Compatibility Issues:
  • The websockets library versions >=14.0 introduce breaking changes that affect OCPP v2.0.0 implementations
  • Recent versions of the OCPP library deprecated several payload types that we were using
  1. Dependency Management Problems:
  • Unpinned dependencies in requirements.txt leading to potentially incompatible package versions being installed
  • Usage of deprecated OCPP payload types causing internal server errors during WebSocket handshake
  • Misalignment between python requirements and loose dependency specifications
  • The solution involves:

a) Package Version Management:

  • Implemented strict version pinning following AWS best practices
  • Specifically restricted websockets==13.0 to maintain OCPP compatibility
  • Updated some dependencies to their last known compatible versions

b) OCPP Implementation Updates:

  • Replaced RegistrationStatusType with RegistrationStatusEnumType
  • Updated BootNotificationPayload to BootNotification
  • Migrated from HeartbeatPayload to Heartbeat
  • Ensured all OCPP message types align with current specifications

c) Code Modernization:

  • Removed deprecated API calls
  • Updated payload structures to match current OCPP standards

References:


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

- feat: specify exact package versions in requirements.txt per AWS MWAA best practices
- fix: restrict websockets to <14.0 due to OCPP v2.0.0 compatibility
- refactor: rename RegistrationStatusType to RegistrationStatusEnumType
- refactor: replace deprecated BootNotificationPayload with BootNotification
- refactor: replace deprecated HeartbeatPayload with Heartbeat()

Ref:
https://aws.amazon.com/blogs/big-data/amazon-mwaa-best-practices-for-managing-python-dependencies/
mobilityhouse/ocpp#709
Copy link
Collaborator

@galinsky galinsky left a comment

Choose a reason for hiding this comment

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

could you just pin the version on the other packages in cpp-gateway-container/requirements.txt for consistency and best practice

Adding missing library versions
@anindith123 anindith123 merged commit 2725c3b into aws-solutions-library-samples:main Feb 28, 2025
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.

3 participants