Skip to content

Possible backwards-incompatible change between 2.1.1 and 2.2.3 #23

Open
@yhoiseth

Description

@yhoiseth

Today, I upgraded from version 2.1.1 to version 2.2.3. The following code started throwing an exception on our queue worker:

    def allowed_hosts(self) -> List[str]:
        allowed_hosts: List[str] = ["localhost", "127.0.0.1", "[::1]"]
        if self.is_valid_platform() and self.in_runtime():
            try:
                for url, route in self.routes().items():
                    host: str = urlparse(url).netloc
                    if (
                        host not in allowed_hosts
                        and route["type"] == "upstream"
                        and route["upstream"] == self.applicationName
                    ):
                        allowed_hosts.append(host)
            except AttributeError:
                """
                The Huey worker doesn't have access to routes.
                """
                pass
        return allowed_hosts

The following exception was raised:

platformshconfig.config.NotValidPlatformException: No routes are defined.  Are you sure you are running on Platform.sh?

By replacing AttributeError with NotValidPlatformException (and adding the required import statement), the problem was resolved.

This caused our transactional emails to not be taken out of the queue while I fixed the issue. Not a huge issue this time because I tested manually and discovered the problem quickly, but not ideal either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions