Could someone give me a hand with some Vaadin help?

I have a flask backend service running on localhost:5000 with the endpoint /logs to retrieve logs. I want to display those logs via a grid.

When I load the vaadin project, I can see in my flask service Im getting a 200 response from vaadin, but vaadin is throwing an error and not updating any table view.

java.lang.NullPointerException: Cannot invoke "com.vaadin.flow.server.VaadinSession.access(com.vaadin.flow.server.Command)" because the return value of "com.vaadin.flow.server.VaadinSession.getCurrent()" is null

Here is my fetch from flask:

private void fetchDataFromFlaskEndpoint() {
        // Use WebClient to make a GET request to Flask endpoint
                .subscribe(entries -> VaadinSession.getCurrent().access(() -> updateGrid(entries)));

Not sure what im doing wrong here? Any guidance would be much appreciated.

Yes, CORS is set up for flask as well.

Trying again with different approach. Currently stuck on datetime formatting. The response from backend is not being parsed properly.

I have tried adding jackson-datatype-jsr310 as a dependency in pom.xml but it doesnt like it for some reason:

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Java 8 date/time type `java.time.LocalDateTime` not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling
 at [Source: (String)"{
  "logs": [
      "level": "debug",
      "message": "this is a debug message",
      "timestamp": "Sun, 28 Jan 2024 06:59:59 GMT"
      "level": "info",
      "message": "This is an info message",
      "timestamp": "Sun, 28 Jan 2024 07:00:01 GMT"
      "level": "warning",
      "message": "This is a warning message",
      "timestamp": "Sun, 28 Jan 2024 07:00:03 GMT"
      "level": "error",
      "message": "This is an error message",
      "times"[truncated 859 chars]; line: 6, column: 20] (through reference chain: java.util.LinkedHashMap["logs"]->java.util.ArrayList[0]->["timestamp"])```

Here is my new fetchLogsFromEndpoint() now im my LogService class:

public List<LogEntry> fetchLogsFromEndpoint() {
        try {
            HttpClient httpClient = HttpClient.newHttpClient();
            HttpRequest request = HttpRequest.newBuilder()
                    .uri(new URI(ENDPOINT_URL))

            HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());

            // Parse the JSON response into a list of LogEntry objects
            ObjectMapper objectMapper = new ObjectMapper();
            Map<String, List<LogEntry>> logMap = objectMapper.readValue(response.body(),
                    new TypeReference<Map<String, List<LogEntry>>>() {

            return logMap.get("logs");
        } catch (Exception e) {
            e.printStackTrace(); // Handle exceptions appropriately in your application
            return null;

With my JacksonConfig() class:

public class JacksonConfig {

    public ObjectMapper objectMapper() {
        ObjectMapper objectMapper = new ObjectMapper();
        objectMapper.registerModule(new JavaTimeModule());
        return objectMapper;

Skipped past trying to parse date/time. Seems that springboot has priority over ObjectMapper. Just parsed as a string. Table loading properly now.

VaadinSession.getCurrent() returns null when called outside the request thread.

Place the VaadinSession.getCurrent() before the WebClient.create(…) and store this in a variable, and then reference that one in the callback/subscribe for the access()