Skip to content
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

On restart verbs are not being loaded correctly via Use-PodeVerbs #1125

Closed
sytone opened this issue Aug 18, 2023 · 1 comment · Fixed by #1127
Closed

On restart verbs are not being loaded correctly via Use-PodeVerbs #1125

sytone opened this issue Aug 18, 2023 · 1 comment · Fixed by #1127
Assignees
Labels
Milestone

Comments

@sytone
Copy link

sytone commented Aug 18, 2023

Describe the Bug

Setup a simpler server, make a verbs folder and add a few files for the verbs you want to support. Add one called restart with something like this in it.

Write-Host "VERB:RESTART"
Add-PodeVerb -Verb 'RESTART' -ScriptBlock {
    Restart-PodeServer
}

Here is my hello verb stored in hello.ps1

Write-Host "VERB:HELLO"
Add-PodeVerb -Verb 'HELLO' -ScriptBlock {
    Write-Host "VERB:HELLO Called"
    Write-PodeTcpClient -Message 'HI'
}

When server starts you can see it loads, when you send RESTART via a TCP call the server does a restart and can be seen via logs. You can see the "VERB:RESTART" message so the file has been . sourced. When you try to send a TCP message for any of the verbs in logs you can see the request received but there is no response. and the contents of the add-podeverb script block is not getting executed at all. Also added logging to wildcard and it is not picking up anything.

Steps To Reproduce

Steps to reproduce the behavior:

  1. See description.

Expected Behavior

On restart the verbs from the path would reload correctly.

Screenshots

NA

Platform

  • OS: Windows 11
  • Browser: NA - TCP
  • Versions:
    • Pode: 2.8.0
    • PowerShell: 7.3.6 - Core

Additional Context

Add any other context about the problem here.

@Badgerati
Copy link
Owner

Hi @sytone,

I've managed to reproduce this locally. The issue is caused by the following line:

$PodeContext.Server.Verbs | Clear-PodeHashtableInnerKeys

This should be the following instead:

$PodeContext.Server.Verbs.Clear()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants