Skip to content

Issue connecting error when calling Add-SmartsheetRow #9

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

Open
jack-vinitsky opened this issue Jan 28, 2025 · 4 comments
Open

Issue connecting error when calling Add-SmartsheetRow #9

jack-vinitsky opened this issue Jan 28, 2025 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@jack-vinitsky
Copy link

Describe the bug
Getting issue connecting error when trying to add new row to a Smartsheet. This was working 2 months ago. I tried run my script again on 1/27/2025 and am now getting errors. Other commands like Search-Smartsheet are working.

To Reproduce
Call Add-SmartsheetRow passing in the sheet ID and RowObject

Expected behavior
The row is added

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Windows 11
  • PowerShell Version [e.g. 5.1, 7.2]: 7.4.4
  • Module Version [e.g. 0.1.0]: 0.2.1

Additional context
Here is the error exception trace:

2025/01/27 11:27:34 [ERROR] - Exception calling "AddRows" with "2" argument(s): "One or more errors occurred. (There was an issue connecting. Error response: )"
2025/01/27 11:27:34 [ERROR] - System.AggregateException: One or more errors occurred. (There was an issue connecting. Error response: )
---> Smartsheet.Api.Internal.Http.HttpClientException: There was an issue connecting. Error response:
at Smartsheet.Api.Internal.Http.DefaultHttpClient.RequestAsync(HttpRequest smartsheetRequest)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Smartsheet.Api.Internal.Http.DefaultHttpClient.Request(HttpRequest smartsheetRequest)
at Smartsheet.Api.Internal.AbstractResources.PostAndReceiveList[T,S](String path, T objectToPost, Type objectClassToReceive)
at Smartsheet.Api.Internal.SheetRowResourcesImpl.AddRows(Int64 sheetId, IEnumerable`1 rows)
at CallSite.Target(Closure, CallSite, Object, Object, Object)

@jack-vinitsky jack-vinitsky added the bug Something isn't working label Jan 28, 2025
@jack-vinitsky
Copy link
Author

Any thoughts on this?

@jack-vinitsky
Copy link
Author

@skywayskase Hi, any thoughts on this error? I also get it when updating a row.

@skywayskase skywayskase self-assigned this Feb 13, 2025
@skywayskase
Copy link
Owner

Hey @jack-vinitsky sorry for the delay. I just tested those functions and didn't receive any errors. Please provide the command you entered, and probably the commands you used to build the cell and row object(s), (and of course, please obfuscate any id numbers and/or PII). Also, please verify your access level on the sheet you're trying to update.

@jack-vinitsky
Copy link
Author

Hi @skywayskase

Thank you for responding back. I am the Owner of the sheet I am trying to update. Here is a simplified version of the code I am running that is also giving me the same error.

Import-Module -Name PSSmartsheet
$SMARTSHEET_ACCESS_TOKEN = "<Hidden>"
$SMARTSHEET_SHEET_ID = <Hidden>

Initialize-SmartsheetClient -AccessToken $SMARTSHEET_ACCESS_TOKEN

$sheetColumns = Get-SmartsheetColumn -SheetID $SMARTSHEET_SHEET_ID
# Get the Column IDs for the columns we need to update for a given existing or new row
$colID_TaskID = $sheetColumns[0].Id
$colID_TaskName = $sheetColumns[1].Id
$colID_DueDate = $sheetColumns[2].Id

$cellTaskID = New-SSCellObject -ColumnID $colID_TaskID -Value "QST-00005"
$cellTaskName = New-SSCellObject -ColumnID $colID_TaskName -Value "Task 5"
$cellDueDate = New-SSCellObject -ColumnID $colID_DueDate -Value "2025-02-17"

$newRow = New-SSRowObject -Cells $cellTaskID, $cellTaskName, $cellDueDate

$newSSRowId = Add-SmartsheetRow -SheetId $SMARTSHEET_SHEET_ID -Rows $newRow -ErrorAction Stop

Write-Output "Row, $newSSRowId, added successfully"

Error occurs on the row with the Add-SmartsheetRow command. I am returning the column IDs earlier in the script without issue.

Here is the full error trace:

ErrorRecord : Exception calling "AddRows" with "2" argument(s): "One or more errors occurred. (There was an issue connecting. Error response: )"
WasThrownFromThrowStatement : False
TargetSite : Void CheckActionPreference(System.Management.Automation.Language.FunctionContext, System.Exception)
Message : Exception calling "AddRows" with "2" argument(s): "One or more errors occurred. (There was an issue connecting. Error response: )"
Data : {[System.Management.Automation.Interpreter.InterpretedFrameInfo, System.Management.Automation.Interpreter.InterpretedFrameInfo[]]}
InnerException : System.AggregateException: One or more errors occurred. (There was an issue connecting. Error response: )
---> Smartsheet.Api.Internal.Http.HttpClientException: There was an issue connecting. Error response:
at Smartsheet.Api.Internal.Http.DefaultHttpClient.RequestAsync(HttpRequest smartsheetRequest)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Smartsheet.Api.Internal.Http.DefaultHttpClient.Request(HttpRequest smartsheetRequest)
at Smartsheet.Api.Internal.AbstractResources.PostAndReceiveList[T,S](String path, T objectToPost, Type objectClassToReceive)
at Smartsheet.Api.Internal.SheetRowResourcesImpl.AddRows(Int64 sheetId, IEnumerable1 rows) at CallSite.Target(Closure, CallSite, Object, Object, Object) HelpLink : Source : System.Management.Automation HResult : -2146233087 StackTrace : at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception) at System.Management.Automation.Interpreter.ActionCallInstruction2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)

InnerExceptions : {Smartsheet.Api.Internal.Http.HttpClientException: There was an issue connecting. Error response:
at Smartsheet.Api.Internal.Http.DefaultHttpClient.RequestAsync(HttpRequest smartsheetRequest)}
Message : One or more errors occurred. (There was an issue connecting. Error response: )
TargetSite : Boolean Wait(Int32, System.Threading.CancellationToken)
Data : {}
InnerException : Smartsheet.Api.Internal.Http.HttpClientException: There was an issue connecting. Error response:
at Smartsheet.Api.Internal.Http.DefaultHttpClient.RequestAsync(HttpRequest smartsheetRequest)
HelpLink :
Source : System.Private.CoreLib
HResult : -2146233088
StackTrace : at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Smartsheet.Api.Internal.Http.DefaultHttpClient.Request(HttpRequest smartsheetRequest)
at Smartsheet.Api.Internal.AbstractResources.PostAndReceiveList[T,S](String path, T objectToPost, Type objectClassToReceive)
at Smartsheet.Api.Internal.SheetRowResourcesImpl.AddRows(Int64 sheetId, IEnumerable`1 rows)
at CallSite.Target(Closure, CallSite, Object, Object, Object)

TargetSite : Void MoveNext()
Message : There was an issue connecting. Error response:
Data : {}
InnerException :
HelpLink :
Source : smartsheet-csharp-sdk
HResult : -2146233088
StackTrace : at Smartsheet.Api.Internal.Http.DefaultHttpClient.RequestAsync(HttpRequest smartsheetRequest)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants