https://prefect.io logo
Title
p

Pekka

11/02/2022, 12:43 PM
Hi. I'm running this test code against a docker-compose'd S3 bucket + PrefectHQ Orion server.
with prefect.settings.temporary_settings(updates={prefect.settings.PREFECT_API_URL: prefect_api_url}):

            block = prefect.filesystems.RemoteFileSystem(basepath=f"s3://{bucket_name}/",
                                                         settings={"client_kwargs": {"endpoint_url": endpoint_url}})

            block.save("s3-testbucket", overwrite=True)

            block.register_type_and_schema()

            deployment = prefect.deployments.Deployment.build_from_flow(
                flow=prefect_cc.coreflows.flows.mh_fi_etl_flow.the_flow,
                name=deployment_name,
                storage=block,
                work_queue_name=work_queue_name
            )

            t = deployment.apply()
it's raising
E           prefect.exceptions.PrefectHTTPStatusError: Client error '403 Forbidden' for url '<http://localhost:4200/api/block_types/27b5cbc1-88e9-4378-bd82-3adb9125b432>'
E           Response: {'detail': 'protected block types cannot be updated.'}
E           For more information check: <https://httpstatuses.com/403>
this happens regardless of the
block.register_type_and_schema
or not -- I don't know how to debug -- the offending line is the the line:
deployment.apply()
even this breaks
block = prefect.filesystems.RemoteFileSystem.load("s3-testbucket")
            # leaving the server running and making sure the block exists

            deployment = prefect.deployments.Deployment.build_from_flow(
                flow=prefect_cc.coreflows.flows.mh_fi_etl_flow.the_flow,
                name=deployment_name,
                storage=block,
                work_queue_name=work_queue_name
            )

            t = deployment.apply()
-- both the Block (
s3-testbucket
) and the Flow show up but there is no Deployment or Work Queue
INFO:     172.28.0.1:38624 - "PATCH /block_types/6701d78b-8719-4db5-9303-cfd648460183 HTTP/1.1" 403 Forbidden
-- https://docs.prefect.io/api-ref/rest-api/#/Block%20types/update_block_type_block_types__id__patch -- this is not documented
βœ… 1
k

Kalise Richmond

11/02/2022, 5:14 PM
Hi @Pekka could you move this into a thread so it is easier to read and follow along? Are you using the s3 block from the prefect-aws collection?
b

Bianca Hoch

11/02/2022, 5:31 PM
Hi Pekka, your issue seems very similar to what a user was experiencing previously. You may want to try checking to see if any of the components of your setup are running an older version of Prefect. What version of Prefect are you using?
πŸ™Œ 1
p

Pekka

11/03/2022, 10:08 AM
the problem was solved by forcing the precisely same version numbers everywhere!
Binaca you must be an angel
πŸ˜›anda-dancing: 1
🎊 1
b

Bianca Hoch

11/03/2022, 1:56 PM
Happy to get you unblocked Pekka!
🀨 1