ahochsteger/gmail-processor

Errors when attempting to pull threads from 3+ years ago

grafpaper1987 opened this issue · 1 comments

Describe the bug

When my thread match query attempts to pull threads from 3+ years ago, I get the following error:

6:01:31 PM	Error	
TypeError: Cannot read properties of null (reading 'length')
redact	@ GmailProcessorLib.gs:4868
processEntity	@ GmailProcessorLib.gs:4543
processConfig	@ GmailProcessorLib.gs:4529
processConfigs	@ GmailProcessorLib.gs:4494
run	@ GmailProcessorLib.gs:4139
runWithJson	@ GmailProcessorLib.gs:4149
run	@ GmailProcessorLib.gs:87900
run	@ Code.gs:46

To Reproduce

Steps to reproduce the behavior:

Here is the code that I'm using:

function run() {
  const config = {
    "description": "This is a simple example to start with Gmail Processor.",
    "settings": {
      "markProcessedMethod": "add-label",
      "markProcessedLabel": "BINGO",
      "maxBatchSize": "100",
      "logLevel": "warn",
      "maxRuntime": "280"
    },
    "global": {
      "thread": {
        "match": {
          "query": "has:attachment -in:trash -in:drafts -in:spam from: after:2020-01-01"
        }
      }
    },
    "threads": [
      {
        "match": {
          "query": "from:"
        },
        "messages": [
          {
            "attachments": [
              {
                "match": {
                  "name": ".xml"
                },
                "actions": [
                  {
                    "name": "attachment.store",
                    "args": {
                      "location": "{REDACTED}/Facturas/${message.date}-${attachment.name}",
                      "conflictStrategy": "replace"
                    }
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }
  GmailProcessorLib.run(config, GmailProcessorLib.RunMode.SAFE_MODE)

}

Expected behavior

I expected the Gmail Processor to identify matching threads and messages from 2021 and 2020 and save down the relevant files to the specified Google Drive folder.

Logs / Screenshots

image

Additional context

The script runs as expected then I change the query to be after 2023-01-01, for example.

Affected version of gmail-processor: 25

Add any other context about the problem here.

@grafpaper1987 the release 2.10.1 (GAS version 27) should fix the problem.
The root cause may have been an email with an empty subject.