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

Sync Snapshot - Receive an error when Web Spotlight is not configured in the project #116

Open
ileshmistry opened this issue Jan 2, 2025 · 6 comments

Comments

@ileshmistry
Copy link

Brief bug description

When using the sync command with a config file I get an error if Web Spotlight is not turned on in my project

What went wrong?
I got an error when trying to sync and it did not complete the process

Repro steps

When running this npx @kontent-ai/data-ops@latest sync snapshot --configFile config.json using the config file example
{ "environmentId": "<environment-id>", "apiKey": "<Management-API-key>", "folderName": "./my-content-model", "entities": [ "contentTypes", "contentTypeSnippets", "taxonomies", "collections", "assetFolders", "spaces", "languages", "webSpotlight", "workflows" ] } from the Sync Snapshot readme - https://github.com/kontent-ai/data-ops/blob/main/src/commands/sync/snapshot/README.md

I got this error

Fetching the model from "myEnvironmentID" . Error: {"validationErrors":[],"message":"You do not have sufficient permissions to perform requested action.","requestId":"739ef5501ad67693","errorCode":16,"originalError":{"message":"Request failed with status code 403"}}

Expected behavior

Complete without Web Spotlight configured

What is the correct behavior?

I would have thought an graceful error should show up to say something like "Web Spotlight not turned on", remove from config file or turn on in the project

Test environment

Just tested in VS Code using Node v22.12.0 using npx @kontent-ai/data-ops@latest (version 2.2.2)

Additional context

Add any other context about the problem here.

Screenshots

Add links to screenshots, if possible.

@IvanKiral
Copy link
Contributor

Hey @ileshmistry, how do you know it is connected to Web Spotlight? From the error and information you provided, I would say your MAPI key does not have enough permissions to fetch some data.

@ileshmistry
Copy link
Author

I basically removed the , "webSpotlight" from my file and the sync snapshot ran without problems, as soon as I added it back in, it failed

@IvanKiral
Copy link
Contributor

This is kind of misleading, if you remove it from the config file it means it won't be fetched at all so no MAPI call against the Web Spotlight endpoint is fired, therefore it can't error on that.

I still think your MAPI key does not have enough permissions.

In the application, you need to have this permission enabled.
image

I am not sure why it is this one :/

@ileshmistry
Copy link
Author

ileshmistry commented Jan 2, 2025

Ah yes, you're right, this resolved this issue.

It might be good to know which of the Permissions we need to have for the different commands, as ticking them all doesn't make sense and looks like it works with both these selections only.

Screenshot 2025-01-02 at 15 35 34

I would have thought reading Content Types would need to be selected 😕

@IvanKiral
Copy link
Contributor

well this is more of a problem of MAPI permissions than data-ops :/

In ideal, they should be more descriptive of what they are doing... Moreover, the error says that you don't have enough permissions that was true. I will ask the team, whether that can't be fixed instead. What I see as an improvement for data-ops is to have a note in readme to check MAPI permissions when running the command. What do you think about this?

@ileshmistry
Copy link
Author

ileshmistry commented Jan 2, 2025

Ah okay. yeah it would be nice for the team to see if they can clarify and fix it.

But adding it to the readme for now should do, as then people won't run into the same issues.

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

No branches or pull requests

2 participants