Comments (1)
I think I've found a solution for this by removing Invoke-WebRequest
and using System.Net.Http.HttpClient
directly.
function Get-APIResource {
param(
[Parameter (Mandatory=$true)]$Resource,
[Parameter (Mandatory=$true)]$SearchQuery
)
$BaseURL = ""
$httpClient = New-Object System.Net.Http.HttpClient
$httpClient.DefaultRequestHeaders.Add("ApiCode", $env:ApiCode)
$httpClient.DefaultRequestHeaders.Add("UserName", $env:APIUser)
$httpClient.DefaultRequestHeaders.Add("APIKey", $env:APIKey)
$ResourceURL = $BaseURL + $Resource + '/query?search=' + $SearchQuery
$i = 1
try {
do {
Write-Warning "Getting page $i of $Resource"
$responseStream = $httpClient.GetStreamAsync($ResourceURL).Result
$streamReader = [System.IO.StreamReader]::new($responseStream)
$responseContent = $streamReader.ReadToEnd()
$Response = $ResponseContent | ConvertFrom-Json
If ($Response.items){
Write-Warning "($i) Retrieved $($Response.items.count) items"
$Response.items | ForEach-Object{
$_
#$ReturnList.Add($_)
}
}
If ($Response.item){
Write-Warning "($i) Retrieved $($Response.item.count) ITEM"
$Response.item | ForEach-Object{
$_
#$ReturnList.Add($_)
}
}
$ResourceURL = $Response.pagedetails.nextPageUrl
If ($null -eq $ResourceURL){
Write-Warning "($i) ResourceURL is null"
} Else {
Write-Warning "($i) Next page URL: $ResourceURL"
}
$i++
} while ($null -ne $ResourceURL)
}
catch {
Write-Error "Connecting to API Failed."
throw "API Error: $($_.Exception.Message)"
}
}
I have no idea why I'm unable to reproduce the error calling the class directly. My guess is it's some perfect storm between the language runtime, Invoke-WebRequest
, and the remote API in question. Hope this helps someone else.
from azure-functions-durable-powershell.
Related Issues (14)
- Change the type of `DurableTask.Core.History.HistoryEvent` so it is not accessed from the global namespace
- Refine the `DurableTask` written to output by `WaitAny`
- Update templates for external SDK HOT 1
- Add remaining Durable Functions tests from the PowerShell worker
- Remove `External` and `E` suffixes from Durable cmdlets
- Remove the `Microsoft.Azure.WebJobs.Extensions.DurableTask` nupkg from the test function app HOT 1
- Action required: self-attest your goal for this repository HOT 5
- Linux ADO agents may fail test runs due to timeouts
- Tracking depedency: keep serialization logic to match worker serialization
- Action required: migrate or opt-out of migration to GitHub inside Microsoft HOT 3
- Durable activity failures still not working properly in Fan out/Fan in orchestrator HOT 16
- Still can't seem to pass complex output to activity functions HOT 1
- Get-DurableStatus still causing Error 401 (Unauthorized) in Azure Function App
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-functions-durable-powershell.