PrefectHQ / PrefectHQ/examples
List block type versions script errors with some block types
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 31
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
The script to list the block type versions worked fine for me in one workspace, but not in another.
I tried deleting custom block types, but that didn't fix the issue.
Error:
Traceback (most recent call last):
File "/Users/jeffhale/Desktop/prefect/demos/list_block_type_versions.py", line 61, in <module>
asyncio.run(main())
File "/Users/jeffhale/.local/share/uv/python/cpython-3.12.6-macos-aarch64-none/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/Users/jeffhale/.local/share/uv/python/cpython-3.12.6-macos-aarch64-none/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jeffhale/.local/share/uv/python/cpython-3.12.6-macos-aarch64-none/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/jeffhale/Desktop/prefect/demos/list_block_type_versions.py", line 47, in main
block_schema.block_type.name,
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'block_type'
List of blocks from prefect block ls:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Block Type Slug ┃ Description ┃ Generate creation link ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ aws-credentials │ Block used to manage authentication with AWS │ prefect block create aws-credentials │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ aws-secret │ Manages a secret in AWS's Secrets Manager │ prefect block create aws-secret │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ airbyte-connection │ A block representing an existing Airbyte │ prefect block create airbyte-connection │
│ │ connection │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ airbyte-server │ A block representing an Airbyte server for │ prefect block create airbyte-server │
│ │ generating AirbyteClient instances │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ azure │ DEPRECATION WARNING: │ prefect block create azure │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ azure-blob-storage-container │ Represents a container in Azure Blob Storage │ prefect block create │
│ │ │ azure-blob-storage-container │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ azure-blob-storage-credentials │ Stores credentials for authenticating with │ prefect block create │
│ │ Azure Blob Storage │ azure-blob-storage-credentials │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ azure-container-instance-credentials │ Block used to manage Azure Container │ prefect block create │
│ │ Instances authentication │ azure-container-instance-credentials │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ azure-container-instance-job │ DEPRECATION WARNING: This block is deprecated │ prefect block create │
│ │ along with Agents and all other │ azure-container-instance-job │
│ │ Infrastructure blocks │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ azure-cosmos-db-credentials │ Block used to manage Cosmos DB authentication │ prefect block create │
│ │ with Azure │ azure-cosmos-db-credentials │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ azureml-credentials │ Block used to manage authentication with │ prefect block create azureml-credentials │
│ │ AzureML │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ bigquery-warehouse │ A block for querying a database with BigQuery │ prefect block create bigquery-warehouse │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ bitbucket-credentials │ Store BitBucket credentials to interact with │ prefect block create bitbucket-credentials │
│ │ private BitBucket repositories │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ bitbucket-repository │ Interact with files stored in BitBucket │ prefect block create bitbucket-repository │
│ │ repositories │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ census-credentials │ Credentials block for credential use across │ prefect block create census-credentials │
│ │ Census tasks and flows │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ census-sync │ Runs a Census sync This block is part of the │ prefect block create census-sync │
│ │ prefect-census collection │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ coiled-credentials │ Block used to manage authentication to Coiled │ prefect block create coiled-credentials │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ database-credentials │ Block used to manage authentication with a │ prefect block create database-credentials │
│ │ database │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ databricks-credentials │ Block used to manage Databricks │ prefect block create databricks-credentials │
│ │ authentication │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ date-time │ A block that represents a datetime │ prefect block create date-time │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ discord-webhook │ Enables sending notifications via a provided │ prefect block create discord-webhook │
│ │ Discord webhook │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ docker-container │ Runs a command in a container │ prefect block create docker-container │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ docker-host │ Store settings for interacting with a Docker │ prefect block create docker-host │
│ │ host │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ docker-registry │ DEPRECATION WARNING: │ prefect block create docker-registry │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ docker-registry-credentials │ Store credentials for interacting with a │ prefect block create │
│ │ Docker Registry │ docker-registry-credentials │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ ecs-task │ DEPRECATION WARNING: This block is deprecated │ prefect block create ecs-task │
│ │ along with Agents and all other │ │
│ │ Infrastructure blocks │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ email │ Sends an email to one or more recipients │ prefect block create email │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ email-server-credentials │ Block used to manage generic email server │ prefect block create │
│ │ authentication │ email-server-credentials │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ firebolt-credentials │ Store credentials for authenticating with │ prefect block create firebolt-credentials │
│ │ Firebolt │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ firebolt-database │ Connects to a Firebolt database │ prefect block create firebolt-database │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ cloud-run-job │ DEPRECATION WARNING: This block is deprecated │ prefect block create cloud-run-job │
│ │ along with Agents and all other │ │
│ │ Infrastructure blocks │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ gcp-credentials │ Block used to manage authentication with GCP │ prefect block create gcp-credentials │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ gcs │ DEPRECATION WARNING: │ prefect block create gcs │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ gcs-bucket │ Block used to store data using GCP Cloud │ prefect block create gcs-bucket │
│ │ Storage Buckets │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ gcpsecret │ Manages a secret in Google Cloud Platform's │ prefect block create gcpsecret │
│ │ Secret Manager │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ github │ DEPRECATION WARNING: │ prefect block create github │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ github-credentials │ Block used to manage GitHub authentication │ prefect block create github-credentials │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ github-repository │ Interact with files stored on GitHub │ prefect block create github-repository │
│ │ repositories │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ gitlab-credentials │ Store a GitLab personal access token to │ prefect block create gitlab-credentials │
│ │ interact with private GitLab │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ gitlab-repository │ Interact with files stored in GitLab │ prefect block create gitlab-repository │
│ │ repositories │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ hex-credentials │ Block used to manage Hex authentication │ prefect block create hex-credentials │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ hightouch-credentials │ Block used to manage Hightouch authentication │ prefect block create hightouch-credentials │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ json │ A block that represents JSON │ prefect block create json │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ kubernetes-cluster-config │ Stores configuration for interaction with │ prefect block create │
│ │ Kubernetes clusters │ kubernetes-cluster-config │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ kubernetes-credentials │ Credentials block for generating configured │ prefect block create kubernetes-credentials │
│ │ Kubernetes API clients │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ kubernetes-job │ Runs a command as a Kubernetes Job │ prefect block create kubernetes-job │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ k8s-job │ A block representing a Kubernetes job │ prefect block create k8s-job │
│ │ configuration │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ lambda-function │ Invoke a Lambda function │ prefect block create lambda-function │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ local-file-system │ Store data as a file on a local file system │ prefect block create local-file-system │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ mattermost-webhook │ Enables sending notifications via a provided │ prefect block create mattermost-webhook │
│ │ Mattermost webhook │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ ms-teams-webhook │ Enables sending notifications via a provided │ prefect block create ms-teams-webhook │
│ │ Microsoft Teams webhook │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ minio-credentials │ Block used to manage authentication with │ prefect block create minio-credentials │
│ │ MinIO │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ modal-credentials │ Block used to manage authentication to Modal │ prefect block create modal-credentials │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ monday-credentials │ Block used to manage Monday authentication │ prefect block create monday-credentials │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ monte-carlo-credentials │ Block used to manage Monte Carlo │ prefect block create monte-carlo-credentials │
│ │ authentication │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ openai-completion-model │ A block that contains config for an OpenAI │ prefect block create openai-completion-model │
│ │ Completion Model │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ openai-credentials │ Credentials used to authenticate with OpenAI │ prefect block create openai-credentials │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ openai-image-model │ A block that contains config for an OpenAI │ prefect block create openai-image-model │
│ │ Image Model │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ opsgenie-webhook │ Enables sending notifications via a provided │ prefect block create opsgenie-webhook │
│ │ Opsgenie webhook │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ pager-duty-webhook │ Enables sending notifications via a provided │ prefect block create pager-duty-webhook │
│ │ PagerDuty webhook │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ process │ Run a command in a new process │ prefect block create process │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ remote-file-system │ Store data as a file on a remote file system │ prefect block create remote-file-system │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ s3 │ DEPRECATION WARNING: │ prefect block create s3 │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ s3-bucket │ Block used to store data using AWS S3 or │ prefect block create s3-bucket │
│ │ S3-compatible object storage like MinIO │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ smb │ Store data as a file on a SMB share │ prefect block create smb │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ sqlalchemy-connector │ Block used to manage authentication with a │ prefect block create sqlalchemy-connector │
│ │ database │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ secret │ A block that represents a secret value │ prefect block create secret │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ sendgrid-email │ Enables sending notifications via Sendgrid │ prefect block create sendgrid-email │
│ │ email service │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ shell-operation │ A block representing a shell operation, │ prefect block create shell-operation │
│ │ containing multiple commands │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ slack-credentials │ Block holding Slack credentials for use in │ prefect block create slack-credentials │
│ │ tasks and flows │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ slack-webhook │ Enables sending notifications via a provided │ prefect block create slack-webhook │
│ │ Slack webhook │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ snowflake-connector │ Perform data operations against a Snowflake │ prefect block create snowflake-connector │
│ │ database │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ snowflake-credentials │ Block used to manage authentication with │ prefect block create snowflake-credentials │
│ │ Snowflake │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ string │ A block that represents a string │ prefect block create string │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ twilio-sms │ Enables sending notifications via Twilio SMS │ prefect block create twilio-sms │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ twitter-credentials │ Block used to manage Twitter authentication │ prefect block create twitter-credentials │
│ │ with tweepy │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ vertex-ai-custom-training-job │ DEPRECATION WARNING: This block is deprecated │ prefect block create │
│ │ along with Agents and all other │ vertex-ai-custom-training-job │
│ │ Infrastructure blocks │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ webhook │ Block that enables calling webhooks │ prefect block create webhook │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ dbt-cli-bigquery-target-configs │ dbt CLI target configs containing credentials │ prefect block create │
│ │ and settings, specific to BigQuery │ dbt-cli-bigquery-target-configs │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ dbt-cli-global-configs │ Global configs control things like the visual │ prefect block create dbt-cli-global-configs │
│ │ output │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ dbt-cli-postgres-target-configs │ dbt CLI target configs containing credentials │ prefect block create │
│ │ and settings specific to Postgres │ dbt-cli-postgres-target-configs │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ dbt-cli-profile │ Profile for use across dbt CLI tasks and │ prefect block create dbt-cli-profile │
│ │ flows │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ dbt-cli-snowflake-target-configs │ Target configs contain credentials and │ prefect block create │
│ │ │ dbt-cli-snowflake-target-configs │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ dbt-cli-target-configs │ Target configs contain credentials and │ prefect block create dbt-cli-target-configs │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ dbt-cloud-credentials │ Credentials block for credential use across │ prefect block create dbt-cloud-credentials │
│ │ dbt Cloud tasks and flows │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ dbt-cloud-job │ Block that holds the information and methods │ prefect block create dbt-cloud-job │
│ │ to interact with a dbt Cloud job │ │
├──────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤
│ dbt-core-operation │ A block representing a dbt operation, │ prefect block create dbt-core-operation │
│ │ containing multiple dbt and shell commands │ │
└──────────────────────────────────────┴───────────────────────────────────────────────┴──────────────────────────────────────────────┘
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with scripts/list_block_versions.py, using the traceback's line 47 in demos/list_block_type_versions.py as the entry point. Run the script against the listed workspace blocks and inspect which lookup returns None before accessing block_type. Done means the script lists versions without raising AttributeError for valid block types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100