This means your query is taking a longer time to return the result back to your CSP application than what it expects.

I'd recommend you to verify why it's taking so long and optimize your query, but you can also ask the CSP gateway to wait for a longer period before it times out.

  // On OnPreHTTP callback method.
  set %response.Timeout = 900 // this will make your application wait for the response for 900 seconds.

Note that %response.Timeout will change the timeout for the current request only.

Thanks for everyone's suggestions. But we have opted for using CompilePackage while providing the method the argument dynamically by using envs.

EDIT: Now that I have seen this qualifier, I'll be doing some tests to see the result.
EDIT #2: Looks like it works as I intended, so please ignore  the text below. 

Yes, this is really painful if you think about using IRIS to generate artifacts for relatively new Caché versions. They can't read some changes that IRIS made, like:

* IRIS also moves away from %Library.CacheStorage which is used by Caché as it instead now uses %Storage.SQL. It also unifies the storage strategy for both: %Persistent classes and custom storage, which Cache used two distinct storage classes, one being %CacheStorage.
* Some XML elements have been modified or wiped out.
* The XML header now prints generator=IRIS instead of generator=Cache.
* Methods that have [ Language = cache ]. are now converted to [ Language = objectscript ].

This is what lead us to create a custom docker image that hosts Caché instead of IRIS for using it to generate continuous delivery.

%CSP.StreamServer is just a helper to cut short some manual labor.

What you need to do is write the file stream back to the device and change three Content-* headers as follows.

Your CSP page has an OnPreHTTP just like every %CSP.Page extended class. You can use this method to modify the Content-Type, Content-Disposition and Content-Length headers. In your case you'll need to use the <script> tag syntax for creating the method.

The example below assumes you're using a class instead.

NOTE: If you really customize your %CSP.Page or %CSP.REST. You don't even need to use the OnPreHTTP method. But I'll be using it here for educational purposes.

ClassMethod OnPreHTTP() As %Boolean [ ServerOnly = 1 ]
{
   set file = %request.GetMimeData("FileStream")
   if '$isobject(file) return 0

   do ##class(%CSP.StreamServer).FileClassify("XLS", .contentType, .isBinary, .charset)
   do %response.SetHeader("Content-Type", contentType)
   do %response.SetHeader("Content-Disposition", "attachment; filename=""_file.FileName_""")

  return 1
}

ClassMethod OnPage() As %Status [ ServerOnly = 1 ]
{
  set iStream = %request.GetMimeData("FileStream")
  $$$QuitOnError(##class(something).method(iStream, .oStream))

  do %response.SetHeader("Content-Length", oStream.Size)

  do oStream.Rewind()
  do oStream.OutputToDevice()

  return $$$OK
}

I think it is:

write %request.GetCgiEnv("HTTP_APPLICATION_ID")

Although by convention, custom headers should begin with a X character to avoid possible conflicts with future but spec-based implementations.

Check for the following methods:

FindInFiles and FindInFilesRegex.

Optionally you could limit the search for a single project using the method FindInProject.

All methods belong to the %Studio.Project class.

Here's how Atelier does:

            Set tSC=##class(%Studio.Project).FindInFiles(
                tSearch,
                doclist,
                system,
                wholeword,
                casesensitive,
                max,
                "GENERATED="_generated, // filter
                wildcards
            )

But you'll need to use device redirection to capture and parse its content. Because Studio uses these methods to display the results in the Output window.

You need to generate a SSL configuration and provide to your request object by using the SSLConfiguration property, after this you must also inform to your request that you want to use a secure connection by enabling the property Https.

Here's how we send a push using OneSignal:

 set client = ##class(%Net.HttpRequest).%New()
 set client.Server = "onesignal.com"

 // You'll need to generate the configuration to be used below, you can decide its name.
 set client.SSLConfiguration = "OneSignal SSL Config"

 set client.Https = 1
 set client.Authorization = $$$FormatText("Basic %1", $get(^App.Envs("ONESIGNAL_KEY")))
 set client.ContentCharset = "utf-8"
 set client.ContentType = "application/json"
 set client.ContentEncoding = "utf-8"
 set client.NoDefaultContentCharset = 0

 set body = {
   "app_id": ($get(^App.Envs("ONESIGNAL_APPID"))),
   "data": (data),
   "contents": {
       "en": (message),
       "pt": (message)
   },
    "filters": (filters)
}

  set json = body.%ToJSON()
  do client.EntityBody.Write(json)

  set sc = client.Post("/api/v1/notifications")
  return sc

You can generate that SSL configuration using the portal, you can also something like this:

ClassMethod CreateSSLConfigurationIfNoneExists(name As %String)
{
   new $namespace
   set $namespace = "%SYS"

   do ##class(Security.SSLConfigs).Get(name, .p)
   if $data(p) quit   

   set p("CipherList")="ALL:!aNULL:!eNULL:!EXP:!SSLv2"
   set p("CAFile")=""
   set p("CAPath")=""
   set p("CRLFile")=""
   set p("CertificateFile")=""
   set p("CipherList")="ALL:!aNULL:!eNULL:!EXP:!SSLv2"
   set p("Description")=""
   set p("Enabled")=1
   set p("PrivateKeyFile")=""
   set p("PrivateKeyPassword")=""
   set p("PrivateKeyType")=2
   set p("Protocols")=24
   set p("SNIName")=""
   set p("Type")=0
   set p("VerifyDepth")=9
   set p("VerifyPeer")=0

   do ##class(Security.SSLConfigs).Create(name, .p)
}

If you don't want to hook Caché with another language using Caché Bindings, you should use PBKDF2 with SHA256. Otherwise you'll need some external implementation to use bcrypt.

write $System.Encryption.PBKDF2("secret", 15000, $System.Encryption.GenCryptRand(64), 64, 256)

Although IS should really implement bcrypt and Argon with native support.

Try sending the CreatedDate format like this, which is the format used by JSON serializers.

"2019-08-26T16:38:26.893Z"