Skip to content

Instantly share code, notes, and snippets.

@toddwseattle
Created February 4, 2019 21:17
Show Gist options
  • Save toddwseattle/bf982859b51d82a89f7a928d0e91564b to your computer and use it in GitHub Desktop.
Save toddwseattle/bf982859b51d82a89f7a928d0e91564b to your computer and use it in GitHub Desktop.
Powershell Fragment to make debugging firebase functions with the google cloud functions emulator easier
# To use from command line . .\func-help.ps1 Start-FBFuncDeployDebug
# (c) Todd Warren 2018 free for all to use with attribution
function Start-FBFuncDeployDebug {
Param( [parameter(Position = 0, Mandatory = $true)][String]$functionName, [parameter(Position = 1, Mandatory = $false)][Int32]$timeout = 600)
$fdeploy = "functions deploy " + $functionName + " --trigger-http --timeout " + $timeout + 's'
$finspect = "functions inspect " + $functionName + " --pause"
Write-Output $fdeploy
Write-Output $finspect
Invoke-Expression -Command $fdeploy
Invoke-Expression -Command $finspect
}
function Start-FBFuncDeployOnly {
Param( [parameter(Position = 0, Mandatory = $true)][String]$functionName, [parameter(Position = 1, Mandatory = $false)][Int32]$timeout = 600)
$fdeploy = "functions deploy " + $functionName + " --trigger-http --timeout " + $timeout + 's'
Write-Output $fdeploy
Invoke-Expression -Command $fdeploy
}
Set-Alias -Name "fbdd" -Value "Start-FBFuncDeployDebug" -Description "Deploy and debug a function"
Set-Alias -Name "fbd" -Value "Start-FBFuncDeployOnly" -Description "Deploy a function"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment