Natro
Natro
Explore posts from servers
CC#
Created by Natro on 4/21/2024 in #help
Receiving 400 on production, local env works fine
In my Program.cs I do following:
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.Enrich.FromLogContext()
.WriteTo.Console()
.CreateBootstrapLogger();

try
{
// This I can see in the console
Log.Information("Starting web application");

var builder = WebApplication.CreateBuilder(args);

// ...

builder.Host.UseSerilog((context, services, configuration) => configuration
.ReadFrom.Configuration(context.Configuration)
.ReadFrom.Services(services)
.Enrich.FromLogContext()
.WriteTo.Console());

// ...
}
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.Enrich.FromLogContext()
.WriteTo.Console()
.CreateBootstrapLogger();

try
{
// This I can see in the console
Log.Information("Starting web application");

var builder = WebApplication.CreateBuilder(args);

// ...

builder.Host.UseSerilog((context, services, configuration) => configuration
.ReadFrom.Configuration(context.Configuration)
.ReadFrom.Services(services)
.Enrich.FromLogContext()
.WriteTo.Console());

// ...
}
Then in the endpoint it doesnt seem anything is logged. I have suspicion I actually enter the endpoint but inside I also return 400 after some other validation
19 replies
CC#
Created by Natro on 4/21/2024 in #help
Receiving 400 on production, local env works fine
The thing is, I have Serilog enabled. In my endpoint I log stuff, which doesn't get logged (stuff in Program.cs gets logged) so I assume, it doesnt even enter my endpoint.
19 replies
CC#
Created by Natro on 4/21/2024 in #help
Receiving 400 on production, local env works fine
How can I enable more verbose logging for aspnet / mvc validation?
19 replies
CC#
Created by Natro on 4/21/2024 in #help
Receiving 400 on production, local env works fine
No description
19 replies
CC#
Created by Natro on 4/21/2024 in #help
Receiving 400 on production, local env works fine
No description
19 replies
CC#
Created by Natro on 4/21/2024 in #help
Receiving 400 on production, local env works fine
Does that answer your question?
19 replies
CC#
Created by Natro on 4/21/2024 in #help
Receiving 400 on production, local env works fine
For localhost my business logic goes through and I return 204. For production it seems I don't even enter the endpoint and it is being stopped by the MVC 400 handling.
19 replies
CC#
Created by Natro on 4/21/2024 in #help
Receiving 400 on production, local env works fine
Tried setting following as well:
builder.Services.Configure<ApiBehaviorOptions>(options =>
{
options.SuppressModelStateInvalidFilter = true;
});
builder.Services.Configure<ApiBehaviorOptions>(options =>
{
options.SuppressModelStateInvalidFilter = true;
});
19 replies
CC#
Created by Natro on 4/13/2024 in #help
ngrok - How to listen on webhook requests locally (docker)?
No description
6 replies
CC#
Created by Natro on 4/13/2024 in #help
ngrok - How to listen on webhook requests locally (docker)?
My docker-compose:
services:
pyritedocs.api:
container_name: pyritedocs.api
hostname: pyritedocs
image: ${DOCKER_REGISTRY-}pyritedocs.api
build:
context: src
dockerfile: PyriteDocs.Api/Dockerfile
environment:
- ...
ports:
- 8082:80
- 8084:443
depends_on:
grafana:
condition: service_healthy
prometheus:
condition: service_healthy
db:
condition: service_healthy

ngrok:
image: ngrok/ngrok:latest
container_name: ngrok_pyritedocs
restart: unless-stopped
environment:
- NGROK_AUTHTOKEN=${NGROK_AUTHTOKEN}
- BIND_TLS=true
- REGION=eu
command: 'http pyritedocs.api:80'
ports:
- 4040:4040
expose:
- '4040'
services:
pyritedocs.api:
container_name: pyritedocs.api
hostname: pyritedocs
image: ${DOCKER_REGISTRY-}pyritedocs.api
build:
context: src
dockerfile: PyriteDocs.Api/Dockerfile
environment:
- ...
ports:
- 8082:80
- 8084:443
depends_on:
grafana:
condition: service_healthy
prometheus:
condition: service_healthy
db:
condition: service_healthy

ngrok:
image: ngrok/ngrok:latest
container_name: ngrok_pyritedocs
restart: unless-stopped
environment:
- NGROK_AUTHTOKEN=${NGROK_AUTHTOKEN}
- BIND_TLS=true
- REGION=eu
command: 'http pyritedocs.api:80'
ports:
- 4040:4040
expose:
- '4040'
6 replies
CC#
Created by Natro on 4/13/2024 in #help
ngrok - How to listen on webhook requests locally (docker)?
Any idea why this is happening?
6 replies