Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): convert Windows absolute paths to file URLs for dynamic imports #7126

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jtmaveryk
Copy link

fix(ci): convert Windows absolute paths to file URLs for dynamic imports

The dynamic import in importAlterationScript was failing on Windows because it used an absolute file path without converting it to a valid file URL. This commit updates the code to use pathToFileURL for converting file paths, resolving the ERR_UNSUPPORTED_ESM_URL_SCHEME error during database alteration deployment.

Summary

This change fixes a bug where dynamic imports were failing on Windows due to the use of absolute file paths without the proper file:// scheme. By converting these paths using Node's pathToFileURL, the error is resolved and the deployment process works consistently across platforms.

Testing

Tested on Windows by running the logto db alt deploy command with a sample database URL. Verified that the alterations deploy successfully without triggering the ERR_UNSUPPORTED_ESM_URL_SCHEME error, and confirmed that existing unit tests pass.

Checklist

  • .changeset
  • unit tests
  • integration tests
  • necessary TSDoc comments

The dynamic import in `importAlterationScript` was failing on Windows because it used an absolute file path without converting it to a valid file URL.
Copy link

COMPARE TO master

Total Size Diff 📈 +57 Bytes

Diff by File
Name Diff
packages/cli/src/commands/database/alteration/index.ts 📈 +57 Bytes

Copy link
Contributor

@wangsijie wangsijie left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants