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

Ch05 todo-web 500 server error #63

Open
tungamajunga opened this issue Mar 18, 2023 · 0 comments
Open

Ch05 todo-web 500 server error #63

tungamajunga opened this issue Mar 18, 2023 · 0 comments

Comments

@tungamajunga
Copy link

Todo-list App

When adding a new item , a 500 server error is returned

After activating Debug log level and setting the application in Development mode , the error is as shown bellow.

FIX

The PR #62 fixes the issue, but the ch04 docker image should be re built and pushed.

For book readers

In the mean time the pull request is accepted/merged, you can build and push your own image from ch04 todo-web docker image by adding the 1 line of code bellow to ch04/docker-images/todo-list/src/Startup.cs as shown in the PR. Then, change the todo-web deployment in ch05 accordingly to use your own image.

 public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);

ERROR

An unhandled exception occurred while processing the request.
InvalidCastException: Cannot write DateTime with Kind=Local to PostgreSQL type 'timestamp with time zone', only UTC is supported. Note that it's not possible to mix DateTimes with different Kinds in an array/range. See the Npgsql.EnableLegacyTimestampBehavior AppContext switch to enable legacy behavior.
Npgsql.Internal.TypeHandlers.DateTimeHandlers.TimestampTzHandler.ValidateAndGetLength(DateTime value, NpgsqlParameter parameter)

@tungamajunga tungamajunga changed the title Ch05 Ch05 todo-web 500 server error Mar 18, 2023
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