Cannot read properties of undefined (reading 'URL_CORS_DOCS") error in Label Studio

Question:

How do I fix the error “Cannot read properties of undefined (reading ‘URL_CORS_DOCS’)” I receive when I click on a task created in Label Studio after importing from Azure Blob Storage using the Python SDK?

Answer:

This error typically indicates a problem with CORS settings on Azure Blob Storage. To correct this, ensure that CORS is properly configured to allow requests from your Label Studio domain. Here are the detailed steps:

  1. Sign in to the Azure Portal and go to your storage account settings.
  2. Locate and visit the “Resource sharing (CORS)” section under your Blob service.
  3. Either add a new CORS rule or adjust existing ones to authorize access from your Label Studio’s origin. For testing, set the “Allowed origins” to * (although a specific origin is recommended for security purposes).
  4. Confirm that “Allowed methods” includes GET and HEAD.
  5. In “Allowed headers” and “Exposed headers,” list necessary headers, like Content-Type and x-ms-* headers.
  6. Define the “Max age (seconds)” for the duration browsers should cache the CORS preflight requests.

After these adjustments, attempt to import the tasks and access them in Label Studio once again.

Make sure that the csv_url in your task import is a valid URL pointing to your CSV file in the Azure Blob Storage. If the file is private, it must be publicly accessible or have a valid SAS token.