Skip to content

fix : when importing the workflow, it automatically check if secret exist.#258

Open
krishna9358 wants to merge 1 commit intomainfrom
@krishna9358/import-export-fix
Open

fix : when importing the workflow, it automatically check if secret exist.#258
krishna9358 wants to merge 1 commit intomainfrom
@krishna9358/import-export-fix

Conversation

@krishna9358
Copy link
Contributor

…s for the secret

Summary

When you export a workflow from one environment and import it into another, the Secret IDs (references to secure credentials) travel with the JSON file. available in the new environment.
If the secret exists: It works fine.
If the secret is missing: The component would still hold onto that old "Reference ID," causing the UI to show a broken or confusing state where it looks like a secret is selected but it's actually invalid (or just a random ID string).

The Solution
We implemented a validation step during the import process in useWorkflowImportExport.ts

  • Check Availability: Before loading the workflow onto the canvas, we now fetch the current user's list of available secrets.
  • Validate References: We loop through every node in the imported workflow, identify which parameters are "secrets" (based on their component definition), and check the value.
  • Sanitize:
  1. If the Secret Exists: We keep the reference. It will show up correctly as a working secret.
  2. If the Secret matches a referenced ID but is NOT found: We automatically remove the reference (delete the value). This ensures the field appears "empty" in the component settings, prompting the user to select a valid secret instead of showing a broken ID.

Testing

  • bun run test
  • bun run lint
  • bun run typecheck
  • Additional notes:

Documentation

  • Updated the relevant doc(s) (see docs/guide.md) or checked that no updates are needed.
  • Recorded contract/architecture changes in both public docs and .ai logs when applicable.

…s for the secret

Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@betterclever
Copy link
Contributor

This PR solves the problem well! One minor UX improvement: show a toast notification when invalid secret references are removed.

Currently they're only logged to console, leaving users confused why fields appear empty. A simple toast({ variant: 'warning', ... }) would immediately inform users what changed and prompt them to re-select valid secrets.

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.

2 participants