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

CMS App - contentful resource ID is invalid #1086

Closed
1 of 2 tasks
lkostrowski opened this issue Oct 31, 2023 · 3 comments · Fixed by #1088
Closed
1 of 2 tasks

CMS App - contentful resource ID is invalid #1086

lkostrowski opened this issue Oct 31, 2023 · 3 comments · Fixed by #1088
Assignees

Comments

@lkostrowski
Copy link
Member

lkostrowski commented Oct 31, 2023

Current implementation of Contentful is setting resource ID as a product variant ID in base64. That was initially implemented this way, because demo database of products in Saleor luckily have IDs that don't include special characters (like ==).

However, variant IDs eventually have characters that are forbidden in Contentful
https://www.contentful.com/developers/docs/references/content-management-api/#/introduction/authentication:~:text=developer%20center.-,Resource%20IDs,-When%20creating%20resources

Implementation of the Contetnful client must be changed. Possibilities:

  • Rely on random ID from contentful
  • decode variant ID: UHJvZHVjdFZhcmlhbnQ6NDIz -> atob -> 'ProductVariant:423' -> replace : with -

Don't decode since Saleor doesn't guarantee ID format

  • Is it breaking change?

Tasks

Preview Give feedback
  1. App: CMS
    lkostrowski
@lkostrowski
Copy link
Member Author

saleor/saleor-docs#1009

@jacobhallenborgprototyp

I my humble opinion, it would be safer to let the target system in (this case Contentful) handle the ID generation itself. That way the App wouldn't have to worry about collisions or format details at all :)

@lkostrowski
Copy link
Member Author

I my humble opinion, it would be safer to let the target system in (this case Contentful) handle the ID generation itself. That way the App wouldn't have to worry about collisions or format details at all :)

Exactly. Especially that Saleor itself doesn't guarantee any format. It guarantees its unique, but format its internal detail of Saleor itself.

I will implement it using system id

@lkostrowski lkostrowski self-assigned this Oct 31, 2023
@lkostrowski lkostrowski linked a pull request Oct 31, 2023 that will close this issue
1 task
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 a pull request may close this issue.

2 participants