You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you find a security vulnerability, do NOT open an issue. Email [email protected] instead.
Describe the bug
When running a migration using npx sanity migration run MIGRATIONNAME and the dataset is missing, it defaults to ~dummy-placeholder-dataset-. When it runs and the dataset its missing, and defaults to the placeholder, it runs and produces a HTTP error
Project id: c53pjo6p
Dataset: ~dummy-placeholder-dataset-
HTTPError: Dataset alias not found: Dataset alias "dummy-placeholder-dataset-" not found for project ID "c53pjo6p"
at assert2xx (/Users/omar/DEV/SanityStudioMigration/sanitymigrationtest/node_modules/@sanity/migrate/lib/index.js:747:278)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async fetchStream (/Users/omar/DEV/SanityStudioMigration/sanitymigrationtest/node_modules/@sanity/migrate/lib/index.js:752:7)
at async Object.dryRun (/Users/omar/DEV/SanityStudioMigration/sanitymigrationtest/node_modules/@sanity/migrate/lib/index.js:912:5)
at async dryRunHandler (/Users/omar/DEV/SanityStudioMigration/sanitymigrationtest/node_modules/sanity/lib/_chunks-cjs/_internal.js:2871:24) {
statusCode: 404
}
Unhandled rejection: HTTPError: Dataset alias not found: Dataset alias "dummy-placeholder-dataset-" not found for project ID "c53pjo6p"
at assert2xx (/Users/omar/DEV/SanityStudioMigration/sanitymigrationtest/node_modules/@sanity/migrate/lib/index.js:747:278)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async fetchStream (/Users/omar/DEV/SanityStudioMigration/sanitymigrationtest/node_modules/@sanity/migrate/lib/index.js:752:7)
at async Object.dryRun (/Users/omar/DEV/SanityStudioMigration/sanitymigrationtest/node_modules/@sanity/migrate/lib/index.js:912:5)
at async dryRunHandler (/Users/omar/DEV/SanityStudioMigration/sanitymigrationtest/node_modules/sanity/lib/_chunks-cjs/_internal.js:2871:24)
As the dataset is required and we're not going to see a dataset with the name ~dummy-placeholder-dataset-, it should probably error instead before creating the client
and then ensure that the dataset is commented out in sanity.cli.ts
exportdefaultdefineCliConfig({api: {projectId: 'c53pjo6p',/** * comment out this line to see the error */// dataset: 'production'},/** * Enable auto-updates for studios. * Learn more at https://www.sanity.io/docs/cli#auto-updates */autoUpdates: true,})
npx sanity migration run updatename
Expected behavior
An error explaining what is missing. Something like the below
if(!apiConfig.dataset){thrownewError("'dataset' has not been provided to the apiConfig")}
Screenshots
If applicable, add screenshots to help explain your problem.
Which versions of Sanity are you using?
Run sanity versions in the terminal and copy-paste the result here.
omar@Omars-MacBook-Pro sanitymigrationtest % sanity versions
@sanity/cli (global) 3.57.4 (up to date)
@sanity/eslint-config-studio 4.0.0 (up to date)
@sanity/vision 3.57.4 (up to date)
sanity 3.57.4 (up to date)
What operating system are you using?
macOS Sonoma 14.7
Windows 11
Which versions of Node.js / npm are you running?
Run npm -v && node -v in the terminal and copy-paste the result here.
Any security issues should be submitted directly to [email protected]. In order to determine whether you are dealing with a security issue, ask yourself these two questions:
Can I access something that's not mine, or something I shouldn't have access to?
Can I disable something for other people? If the answer to either of those two questions are "yes", then you're probably dealing with a security issue. Note that even if you answer "no" to both questions, you may still be dealing with a security issue, so if you're unsure, just email us at [[email protected]](mailto:[email protected].
The text was updated successfully, but these errors were encountered:
Note, nothing is actually broken here, it's just the actual error in unclear. I feel that having a guard statement will prevent a HTTP call being created with an invalid dataset
If you find a security vulnerability, do NOT open an issue. Email [email protected] instead.
Describe the bug
When running a migration using
npx sanity migration run MIGRATIONNAME
and the dataset is missing, it defaults to~dummy-placeholder-dataset-
. When it runs and the dataset its missing, and defaults to the placeholder, it runs and produces a HTTP errorAs the dataset is required and we're not going to see a dataset with the name
~dummy-placeholder-dataset-
, it should probably error instead before creating the clientTo Reproduce
Steps to reproduce the behavior:
I've created a repo demonstrating it here https://github.com/omar-ebrahim/SanityStudioMigration
To run the migration
cd sanitymigrationtest
and then ensure that the dataset is commented out in
sanity.cli.ts
npx sanity migration run updatename
Expected behavior
An error explaining what is missing. Something like the below
Screenshots
If applicable, add screenshots to help explain your problem.
Which versions of Sanity are you using?
Run
sanity versions
in the terminal and copy-paste the result here.What operating system are you using?
macOS Sonoma 14.7
Windows 11
Which versions of Node.js / npm are you running?
Run
npm -v && node -v
in the terminal and copy-paste the result here.omar@Omars-MacBook-Pro sanitymigrationtest % npm -v && node -v 10.6.0 v22.0.0
Additional context
Add any other context about the problem here.
Security issue?
Any security issues should be submitted directly to [email protected]. In order to determine whether you are dealing with a security issue, ask yourself these two questions:
The text was updated successfully, but these errors were encountered: