Skip to content

Basket checkout event handler error #98

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

Open
LeoCopatti opened this issue Apr 15, 2025 · 1 comment
Open

Basket checkout event handler error #98

LeoCopatti opened this issue Apr 15, 2025 · 1 comment

Comments

@LeoCopatti
Copy link

I downloaded the project and was trying to test the code, but when I checkout an order, it publishes on the RabbitMQ queue an erro named basket-checkout-event-handler_error, this error contains the following message:

String or binary data would be truncated in table 'OrderDb.dbo.Orders', column 'BillingAddress_ZipCode'. Truncated value: '11111'.
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_OrderItems_Orders_OrderId". The conflict occurred in database "OrderDb", table "dbo.Orders", column 'Id'.
The statement has been terminated.
The statement has been terminated.

What am I doing wrong here?

@joe97z
Copy link

joe97z commented Apr 21, 2025

can you double check the max length of zip code in Services\Ordering\Ordering.Infrastructure\Data\Configurations\OrderConfiguration.cs ??
addressBuilder.Property(a => a.ZipCode)
.HasMaxLength(5)
.IsRequired();
this would probably solve the "String or binary data would be truncated in table 'OrderDb.dbo.Orders', column 'BillingAddress_ZipCode'. Truncated value: '11111'."
because it's basically saying that "11111" exceeded the max length
by this the order is not being created and while its trying to add order item it gives
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_OrderItems_Orders_OrderId". The conflict occurred in database "OrderDb", table "dbo.Orders", column 'Id'.
because that specific order doesn't exist in the database

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