mbegan / Okta-PSModule

Okta API Powershell Wrapper Module
Other
102 stars 31 forks source link

Error running initial command #19

Closed gharryjr closed 6 years ago

gharryjr commented 6 years ago

I get:

Cannot index into a null array. At C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Okta\Okta.psm1:552 char:45

When I run:

ps c:> oktaGetUserbyID -oOrg prev -uid "myuserid"

I'm new to running Okta API calls in PS, so I am not sure what may be happening here .

mbegan commented 6 years ago

strange... never seen one like that before.

Can you give me some additional context.

From your active powershell console

Check variable it is erroring on / arround

Get-Variable -Name altHeaders

This should error and say it cannot find a variable with that name but I just want to confirm i'm not using a variable that is valid in your env for some other reason...

Powershell Version

PS > $PSVersionTable                                                                                                

#Sample
Name                           Value                                                                                                                                       
----                           -----                                                                                                                                       
PSVersion                      6.0.0-rc                                                                                                                                    
PSEdition                      Core                                                                                                                                        
GitCommitId                    v6.0.0-rc                                                                                                                                   
OS                             Darwin 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64                               
Platform                       Unix                                                                                                                                        
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                     
PSRemotingProtocolVersion      2.3                                                                                                                                         
SerializationVersion           1.1.0.1                                                                                                                                     
WSManStackVersion              3.0   

Additional error context

$Error.Clear()

#run the command that produces the error
oktaGetUserbyID -oOrg prev -uid "myuserid"

#Get list of errors for additional clues
$Error[0..($Error.count)]
noeffort3 commented 6 years ago

Hi Matt,

I just left you a voicemail on your cellie. I am seeing the same error :)

Both prod and prev as values for -oOrg, whether explicit -oOrg 'prod' (or 'prev') or via variable inclusion within xyz script as: $oOrg = 'prev' and used inline in already previously correctly running scripts

Example:

PS C:\windows\system32> oktaGetUserbyID -oOrg prod -userName ThatVMSGuy _oktaNewCall : Cannot validate argument on parameter 'oOrg'. Cannot index into a null array. At C:\Users\sysrgardner\Documents\WindowsPowerShell\Modules\Okta\Okta.psm1:1047 char:75 /+ ... equest = _oktaNewCall -method $method -resource $resource -oOrg $oOrg /+ ~ /+ CategoryInfo : InvalidData: (:) [_oktaNewCall], ParameterBindingValidationException /+ FullyQualifiedErrorId : ParameterArgumentValidationError,_oktaNewCall

/me thinks OKTA backend changed some kind of value?

Cheers!

*Oh sorry, this is that guy, you know, from that place, with the stuff

mbegan commented 6 years ago

@gharryjr I've been unable to replicate the error you are encountering so if you can provide more context (see prev note).

@noeffort3 Hi RG. While the top level error is similar it looks like you are facing something entirely different, it also looks like you are running an old version of the module (line 1047 isn't a part of _oktaNewCall anymore). Can you also provide some additional context (same as the note above for @gharryjr) but open a new issue.

gharryjr commented 6 years ago

Additional info highlighted.

From: Matt Egan [mailto:notifications@github.com] Sent: Monday, February 05, 2018 6:01 PM To: mbegan/Okta-PSModule Okta-PSModule@noreply.github.com Cc: Harry, Greg GHarry-consultant@Scholastic.com; Author author@noreply.github.com Subject: Re: [mbegan/Okta-PSModule] Error running initial command (#19)

strange... never seen one like that before.

Can you give me some additional context.

From your active powershell console

Check variable it is erroring on / arround

Get-Variable -Name altHeaders

This should error and say it cannot find a variable with that name but I just want to confirm i'm not using a variable that is valid in your env for some other reason...

PS C:> Get-Variable -Name altHeaders

Get-Variable : Cannot find a variable with name 'altHeaders'.

At line:1 char:13

Powershell Version

PS > $PSVersionTable

Sample

Name Value


PSVersion 6.0.0-rc

PSEdition Core

GitCommitId v6.0.0-rc

OS Darwin 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64

Platform Unix

PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}

PSRemotingProtocolVersion 2.3

SerializationVersion 1.1.0.1

WSManStackVersion 3.0

PS C:> $PSVersionTable

Name Value


CLRVersion 2.0.50727.5485

BuildVersion 6.1.7601.17514

PSVersion 2.0

WSManStackVersion 2.0

PSCompatibleVersions {1.0, 2.0}

SerializationVersion 1.1.0.1

PSRemotingProtocolVersion 2.1

Addition

error context

$Error.Clear()

run the command that produces the error

oktaGetUserbyID -oOrg prev -uid "myuserid"

PS C:> $Error.Clear()

PS C:> oktaGetUserbyID -oOrg prev -uid gharrytest@.....

Cannot index into a null array.

At C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Okta\Okta.psm1:552 char:45

Get list of errors for additional clues

$Error[0..($Error.count)]

PS C:> $Error[0..($Error.count)]

Cannot index into a null array.

At C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Okta\Okta.psm1:552 char:45

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/mbegan/Okta-PSModule/issues/19#issuecomment-363250884, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AifxbXAvpvdiup35DZ5g_X1yYHIJy1Tyks5tR4gkgaJpZM4R6Cp6.

mbegan commented 6 years ago

Ah!

I think i see the issue, you are running powershell version 2 and it doesn't support some of the basic stuff this module is doing.

I used to have a minimum version check in this package but i had to take it out because of the way it is evaluated when running in different toolkits like vscode.

I believe the minimum powershell version is 3.0 but i'd highly recommend upgrading to version 4.x or newer. Try This

gharryjr commented 6 years ago

Awesome…the update of PS worked for me. Thanks for the quick feedback.

From: Matt Egan notifications@github.com<mailto:notifications@github.com> Reply-To: mbegan/Okta-PSModule reply@reply.github.com<mailto:reply@reply.github.com> Date: Tuesday, February 6, 2018 at 2:23 PM To: mbegan/Okta-PSModule Okta-PSModule@noreply.github.com<mailto:Okta-PSModule@noreply.github.com> Cc: "Scholastic Inc." gharry-consultant@scholastic.com<mailto:gharry-consultant@scholastic.com>, Mention mention@noreply.github.com<mailto:mention@noreply.github.com> Subject: Re: [mbegan/Okta-PSModule] Error running initial command (#19)

Ah!

I think i see the issue, you are running powershell version 2 and it doesn't support some of the basic stuff this module is doing.

I used to have a minimum version check in this package but i had to take it out because of the way it is evaluated when running in different toolkits like vscode.

I believe the minimum powershell version is 3.0 but i'd highly recommend upgrading to version 4.x or newer. Try Thishttps://www.microsoft.com/en-us/download/details.aspx?id=54616

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/mbegan/Okta-PSModule/issues/19#issuecomment-363535724, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AifxbZv3x5YAdrKzLdzRa4Wm4FYvGoghks5tSKbBgaJpZM4R6Cp6.

mbegan commented 6 years ago

Addressed with documentation in commit b72a506

noeffort3 commented 6 years ago

Hmm, interesting... for some reason when i run "git" it refreshes "successfully", just not "correctly" it keeps pulling down the old Nov 17, 2017 set. Used zip. Will try :) Cheers, see ya at Oktane!

**Yup, all good with files marked on 2/6/2018

mbegan commented 6 years ago

with a local git repo the command to fetch and merge changes from the remote repo (github) would be would be git pull

noeffort3 commented 6 years ago

Yeah, Git-Dummy was using git fetch :P