You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run this, I am getting an exception even though I don't have Add-PodeTimers in my script. It seems like it's not recognizing that it's serverless.
Steps To Reproduce
using namespace System.Net
param($Request, $TriggerMetadata)
$endpoint = '/api/isops'
Start-PodeServer -Request $TriggerMetadata -ServerlessType AzureFunctions -RootPath '../www' {
# get route that can return data
Add-PodeRoute -Method Get -Path $endpoint -ScriptBlock {
Write-PodeJsonResponse -Value @{ 'Data' = 'some random data' }
}
# post route to create some data
Add-PodeRoute -Method Post -Path $endpoint -ScriptBlock {
New-Thing -Name $WebEvent.Data['Name']
}
# put route to update some data
Add-PodeRoute -Method Put -Path $endpoint -ScriptBlock {
Update-Thing -Name $WebEvent.Data['Name']
}
}
When I run this in VSCode using the Azure Core Tools, I'm getting an exception:
EXCEPTION: The Add-PodeTimer function is not supported in a serverless context.
ScriptName : [path]]\ManagedDependencies\2410241931327472642.r\Pode\2.11.0\Private\Server.ps1
Line : throw $_.Exception
Statement : throw $_.Exception
PositionMessage : At [path]]\ManagedDependencies\2410241931327472642.r\Pode\2.11.0\Private\Server.ps1:213 char:9
+ throw $_.Exception
+ ~~~~~~~~~~~~~~~~~~
PSScriptRoot : [path]]\ManagedDependencies\2410241931327472642.r\Pode\2.11.0\Private
PSCommandPath : [path]]\ManagedDependencies\2410241931327472642.r\Pode\2.11.0\Private\Server.ps1
CommandOrigin : Internal
ScriptStackTrace : at Start-PodeInternalServer, [path]]\ManagedDependencies\2410241931327472642.r\Pode\2.11.0\Private\Server.ps1: line 213
at Start-PodeServer<End>, [path]]\ManagedDependencies\2410241931327472642.r\Pode\2.11.0\Public\Core.ps1: line 198
Executed 'Functions.isops' (Failed, Id=a4c589ca-0a50-440e-abdb-9ad49c7f7e62, Duration=1924ms)
at <ScriptBlock>, [path]\isops\run.ps1: line 7
Expected Behavior
I'm expecting the page to load.
Platform
OS: Windows
Browser: FireFox
Versions:
Pode: Pode v.2.11
PowerShell: [e.g. PS7.4.5]
Additional Context
I'm running this in VSCode before uploading it to Azure. I'm not sure if it's checking something on my local system to determine whether it's serverless or not. I would expect that if -ServerlessType is set, then that would be the context it would use.
The text was updated successfully, but these errors were encountered:
Describe the Bug
I'm following: https://badgerati.github.io/Pode/Hosting/AzureFunctions/#the-server
When I run this, I am getting an exception even though I don't have Add-PodeTimers in my script. It seems like it's not recognizing that it's serverless.
Steps To Reproduce
When I run this in VSCode using the Azure Core Tools, I'm getting an exception:
Expected Behavior
I'm expecting the page to load.
Platform
Additional Context
I'm running this in VSCode before uploading it to Azure. I'm not sure if it's checking something on my local system to determine whether it's serverless or not. I would expect that if
-ServerlessType
is set, then that would be the context it would use.The text was updated successfully, but these errors were encountered: