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

Set-PodeOAGlobalAuth failure on launch #1406

Closed
tylrtrst opened this issue Oct 6, 2024 · 5 comments · Fixed by #1407
Closed

Set-PodeOAGlobalAuth failure on launch #1406

tylrtrst opened this issue Oct 6, 2024 · 5 comments · Fixed by #1407
Labels
Milestone

Comments

@tylrtrst
Copy link

tylrtrst commented Oct 6, 2024

Describe the Bug

After upgrading from 2.10.1 to 2.11.0, Pode fails to launch and outputs the following error to console:

Pode v2.11.0 (PID: 1)
Set-PodeOAGlobalAuth: /usr/local/share/powershell/Modules/Pode/Public/Authentication.ps1:1645
Line |
1645 |      Set-PodeOAGlobalAuth -DefinitionTag $DefinitionTag -Name $Authent …
     |                                          ~~~~~~~~~~~~~~
     | Cannot bind argument to parameter 'DefinitionTag' because it is an empty
     | string.

reverting back to 2.10.1 corrects the problem.

Steps To Reproduce

Update from 2.10.1 to 2.11.0
Run Pode
View console

Expected Behavior

Expecting Pode to launch without error

Platform

  • OS: Linux (Docker image badgerati/pode:2.11.0-alpine)
  • Versions:
    • Pode: 2.11.0

Additional Context

I am not making use of the OpenAPI feature and have not enabled it.
I have defined 2 auth schemes, both of type: API Key. Only one of which is being applied via middleware.

@mdaneri
Copy link
Contributor

mdaneri commented Oct 6, 2024

I’m not able to reproduce the issue can you please give a sample?

@tylrtrst
Copy link
Author

tylrtrst commented Oct 6, 2024

I've been doing some work to narrow down the problem: In my case it appears to show up when an auth scheme is applied via auth middleware.

Troubleshooting Steps:

  • I removed all auth schemes and auth middlewares. The problem disappeared.
  • I added the auth scheme. The problem did not re-appear.
  • I added the auth middleware referencing the previously mentioned auth scheme. The problem reappeared.

Structure:

My scheme is added via Use-PodeAuth -path './podeAuth' in my configuration and then applied with:

Add-PodeAuthMiddleware -Name 'globalAuthValidation' -Authentication 'authenticateExample' -Route '/api/*'

Example scheme as tested:

file: ./podeAuth/authenticateExample.ps1

New-PodeAuthScheme -ApiKey | Add-PodeAuth -Name 'authenticateExample' -Sessionless -ScriptBlock {
    param($key)
        return $null
}

@mdaneri
Copy link
Contributor

mdaneri commented Oct 7, 2024

Let me try it

@mdaneri
Copy link
Contributor

mdaneri commented Oct 7, 2024

I'm able to reproduce it.
Workaround:
Add a server.psd1 file with at least this content:

@{
    Web    = @{
        OpenApi     = @{
        }
    }
}

mdaneri added a commit to mdaneri/Pode that referenced this issue Oct 7, 2024
Added a new sample for the `Use-PodeAuth` function
@tylrtrst
Copy link
Author

tylrtrst commented Oct 7, 2024

I can confirm that the issue is fixed for me after applying the above workaround.
Thanks for the quick responses, and your work on this project!

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