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

How to register the very first version of a MFE via the Admin API #4

Closed
VelinGeorgievGP opened this issue Dec 22, 2023 · 1 comment
Closed

Comments

@VelinGeorgievGP
Copy link

VelinGeorgievGP commented Dec 22, 2023

Hey @lucamezzalira , guys,

I am playing with the solutions and I managed to successfully deploy it, however I struggle to register my very first version of a MFE via the Admin API.

I am following the API documentation and here are the steps I performed:

  • Cognito Login - Success
  • Create project using POST API - Success
  • Create MFE using the POST API - Success
  • PATCH MFE - Fail
curl https://api.amazonaws.com/prod/projects/d7859c4c-77a2-4b49-a54d-0b407492a31e/microFrontends/5a23e420-1a6c-4ae2-ab94-eebdb3eafea9 -H "Authorization: Bearer <TOKEN>" -H "Content-Type: application/json" --request PATCH --data '{"name": "mfe-2","activeVersions":[{"version": "1.0.0","traffic": 100}],"default": "1.0.0"}' -H "Content-Type: application/json"

I am getting response

The specified version could not be found.

  • I then tested to create a new MFE version using the POST version API with the version payload included
curl https://api.amazonaws.com/prod/projects/d7859c4c-77a2-4b49-a54d-0b407492a31e/microFrontends/17d12cd5-d7fa-4f80-a378-0e3ed20ef8f9/versions -H "Authorization: Bearer <TOKEN>" --request POST --data '{ "version": { "url": "https://static.example.com/my-account-1.0.0.js", "metadata": { "version": "1.0.0", "integrity": "e0d123e5f317bef78bfdf5a008837200" }, "fallbackUrl": "https://alt-cdn.com/my-account-1.0.0.js" }, "deploymentStrategy": "AllAtOnce" }' -H "Content-Type: application/json" 

but got the following error:

Unable to create deployment when no existing version is currently receiving 100% traffic.

  • I tested an extra step and tried to specify version on new MFE creation (POST)
curl https://api.amazonaws.com/prod/projects/d7859c4c-77a2-4b49-a54d-0b407492a31e/microFrontends -H "Authorization: Bearer <TOKEN>" -H "Content-Type: application/json" --request POST --data '{"name": "mfe-2","activeVersions":[{"version": "1.0.0","traffic": 100}]}'

However the MFE entry gets created in the table dropping the activeVersions property.

What am I doing wrong?

Thanks!

@VelinGeorgievGP
Copy link
Author

All right, I got it working by dropping the 'deploymentStrategy' prop from the POST payload.

curl https://api.amazonaws.com/prod/projects/d7859c4c-77a2-4b49-a54d-0b407492a31e/microFrontends/17d12cd5-d7fa-4f80-a378-0e3ed20ef8f9/versions -H "Authorization: Bearer <TOKEN>" --request POST --data '{ "version": { "url": "https://static.example.com/my-account-1.0.0.js", "metadata": { "version": "1.0.0", "integrity": "e0d123e5f317bef78bfdf5a008837200" }, "fallbackUrl": "https://alt-cdn.com/my-account-1.0.0.js" } }' -H "Content-Type: application/json" 

Cheers,

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

1 participant