Skip to content

fix: auto-generate collectionName to fix HTTP context errors#36

Merged
shubham3121 merged 1 commit intomainfrom
fix/crypto-random-uuid-http-error
Jan 29, 2026
Merged

fix: auto-generate collectionName to fix HTTP context errors#36
shubham3121 merged 1 commit intomainfrom
fix/crypto-random-uuid-http-error

Conversation

@itstauq
Copy link
Member

@itstauq itstauq commented Jan 29, 2026

Summary

  • Fixes "crypto.randomUUID is not a function" error for users accessing the app over plain HTTP
  • Makes collectionName optional in the dataset creation API
  • Backend now auto-generates a UUID if collectionName is not provided

Problem

crypto.randomUUID() is a Web API that only works in secure contexts (HTTPS or localhost). Users accessing the app via HTTP on a local network (e.g., http://192.168.x.x:8080) would encounter this error when creating datasets.

Solution

Move the UUID generation responsibility from the frontend to the backend, where it always works regardless of the client's security context.

Test plan

  • Create a dataset over HTTPS - should work as before
  • Create a dataset over HTTP (e.g., via local network IP) - should no longer error

crypto.randomUUID() is only available in secure contexts (HTTPS/localhost).
Users accessing the app over HTTP would get "crypto.randomUUID is not a
function" errors when creating datasets.

Move UUID generation to the backend, making collectionName optional in the
API. The backend now auto-generates a unique identifier if not provided.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes a browser security context error where crypto.randomUUID() fails when users access the application over plain HTTP (non-secure contexts). The fix moves UUID generation responsibility from the frontend to the backend for dataset collection names.

Changes:

  • Removed frontend-side UUID generation using crypto.randomUUID() from dataset creation flows
  • Made collectionName optional in the dataset creation API
  • Backend now auto-generates a UUID for collectionName when not provided during validation

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
frontend/src/composables/useDataEndpointCreation.ts Removed generateCollectionName helper function and stopped passing auto-generated collectionName in dataset configuration
frontend/src/components/CreateDatasetDialogSimple.vue Removed generateCollectionName helper function and stopped passing auto-generated collectionName in dataset configuration
frontend/src/api/types/index.ts Made collectionName optional in CreateDatasetRequest interface
backend/syft_space/components/dataset_types/weaviate_local/weaviate_type.py Added UUID import, updated schema to make collectionName optional, auto-generates UUID in validation when not provided, and updated schema description

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@shubham3121 shubham3121 merged commit f49d7fc into main Jan 29, 2026
9 checks passed
@itstauq itstauq deleted the fix/crypto-random-uuid-http-error branch January 29, 2026 15:02
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