-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for using Pode in Azure Functions and AWS Lambda #264
Comments
Good news is I got this working with Azure Functions: https://pode-test-af.azurewebsites.net/api/PodeSite It's still a work in progress, but an idea of the function app param($Request, $TriggerMetadata)
server -r $TriggerMetadata -rp '../www' {
serverless 'azure-functions'
engine pode
route get '/api/PodeSite' {
view 'simple' -Data @{ 'numbers' = @(1, 2, 3); }
}
}
|
Now, I think I managed to get this working for AWS Lambda, but I can't seem to get PowerShell Lambda functions running locally. Fortunately, there is very little different on the request/response objects between Azure/AWS. This means a Lambda equivalent to the Functions script above would be: #Requires -Modules @{ModuleName='AWSPowerShell.NetCore';ModuleVersion='3.3.509.0'}
#Requires -Modules @{ModuleName='Pode';ModuleVersion='0.0.0'}
server -r $LambdaInput -rp '/tmp/www' {
serverless 'aws-lambda'
engine pode
route get '/PodeSite' {
view 'simple' -Data @{ 'numbers' = @(1, 2, 3); }
}
} Here, |
When running in a serverless context, the unsupported functions are the following - everything else is supported.
Functions to look into:
Sessions are likely all right, if stored externally (or you can have them local if you don't care the data will be wiped often). Flash is possible if sessions are done. Cookie/Redirect/Attach each require headers. CSRF I'm unsure about, is likely just possible from the get go. |
Managed to get all the following functions working:
|
Resolves #264: Add support for serverless
This is to see if it's possible - or even feasible - to host websites/rest-apis in Azure Functions and AWS Lambda, but using Pode for route management.
In both cases, neither Functions or Lambda use the normal
HttpResponse
; so new server types will be needed, with an option to specify if Pode is running in a serverless context.Also, Functions/Lambda have the "request" object supplied to them (
$TriggerMetadata
/$LambdaInput
), so theserver
function will need a parameter to accept adhoc requests objects.Furthermore, due to the nature of Functions/Lambda, the only functions from Pode that will likely work are:
route
middleware
endware
engine
serverless
(new)json
,xml
,csv
,text
,file
There are likely others, but
timers
etc are out.Will also need a way of adding headers/cookies - as there's no
AddHeader
/Cookie
methods, so will have to use the Headers dictionary directly.The text was updated successfully, but these errors were encountered: