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

Export Failure - Execution timeout #483

Open
rtmaus opened this issue Aug 12, 2021 · 3 comments
Open

Export Failure - Execution timeout #483

rtmaus opened this issue Aug 12, 2021 · 3 comments

Comments

@rtmaus
Copy link

rtmaus commented Aug 12, 2021

We are using Powershell and github actions to export a solution:

Github Action

    - name: Export Managed Solution File
      run: |
        ./pipeline/export-solution -CrmUrl ${{ env.DEV_ENVIRONMENT_URL }} -ClientId ${{ env.DEV_CLIENT_ID }} -ClientSecret ${{ env.DEV_CLIENT_SECRET }} -SolutionName ${{ github.event.inputs.solution_name }} -ExportPath ${{ runner.temp }}/${{ github.event.inputs.solution_name }} -IsManaged $true
      shell: powershell

Connection
$crm = Connect-CrmOnline -ClientSecret $clientSecret -OAuthClientId $clientId -ServerUrl $url

When executing the following we are getting intermittent failures of the following:

Export-CrmSolution -SolutionName $SolutionName -conn $CrmSourceConnection -SolutionFilePath $ExportPath -SolutionZipFileName $fileName -Managed -Debug -Verbose

The error returned:

2021-08-11T02:41:57.2891817Z ##[group]Run ./pipeline/export-solution -CrmUrl https://xxx.crm6.dynamics.com -ClientId *** -ClientSecret *** -SolutionName xxx -ExportPath D:\a\_temp/xxx
2021-08-11T02:41:57.2895372Z �[36;1m./pipeline/export-solution -CrmUrl https://xxx.crm6.dynamics.com -ClientId *** -ClientSecret *** -SolutionName xxx -ExportPath D:\a\_temp/xxx�[0m
2021-08-11T02:41:57.2945204Z shell: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.EXE -command ". '{0}'"
2021-08-11T02:41:57.2945948Z env:
2021-08-11T02:41:57.2946926Z   DEV_ENVIRONMENT_URL: https://xxx.crm6.dynamics.com
2021-08-11T02:41:57.2948063Z   TENANT_ID: xxx
2021-08-11T02:41:57.2956479Z   DEV_CLIENT_ID: ***
2021-08-11T02:41:57.2957617Z   DEV_CLIENT_SECRET: ***
2021-08-11T02:41:57.2958179Z   CORE_TOOLS_DIR: coreTools
2021-08-11T02:41:57.2958660Z   RUNNER_DEBUG: 1
2021-08-11T02:41:57.2960177Z ##[endgroup]
2021-08-11T02:41:57.8377885Z Microsoft.Xrm.Data.Powershell Module Found
2021-08-11T02:42:01.0113834Z Crm connection established
2021-08-11T02:42:01.0512500Z WARNING: Please reconnect to the service after setting the connection timeout or the new timeout will *not* be used for
2021-08-11T02:42:01.0513450Z  operations.
2021-08-11T02:42:02.7835815Z Crm connection established
2021-08-11T02:42:02.7842072Z Exporting Solution...
2021-08-11T03:15:24.3125661Z Export-CrmSolution : System.Management.Automation.RuntimeException: ************ TimeoutException - ExportSolution : 
2021-08-11T03:15:24.3127941Z User Defined |=> The request channel timed out while waiting for a reply after 00:33:20. Increase the timeout value 
2021-08-11T03:15:24.3129261Z passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation 
2021-08-11T03:15:24.3130226Z may have been a portion of a longer timeout.
2021-08-11T03:15:24.3131210Z The request channel timed out while waiting for a reply after 00:33:20. Increase the timeout value passed to the call 
2021-08-11T03:15:24.3132356Z to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a 
2021-08-11T03:15:24.3133621Z portion of a longer timeout. => The HTTP request to 
2021-08-11T03:15:24.3135411Z 'https://xxx.crm6.dynamics.com/XRMServices/2011/Organization.svc/web?SDKClientVersion=9.0.45.2156' has 
2021-08-11T03:15:24.3137491Z exceeded the allotted timeout of 00:33:20. The time allotted to this operation may have been a portion of a longer 
2021-08-11T03:15:24.3138943Z timeout. => The operation has timed out[TerminalFailure] Failed to Execute Command - ExportSolution : 
2021-08-11T03:15:24.3140650Z RequestID=93590d3a-142d-47c5-be1e-3da49f57c8f9 : User Defined duration=00:33:20.3691911 ExceptionMessage = The request 
2021-08-11T03:15:24.3142146Z channel timed out while waiting for a reply after 00:33:20. Increase the timeout value passed to the call to Request 
2021-08-11T03:15:24.3143279Z or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a 
2021-08-11T03:15:24.3144127Z longer timeout.
2021-08-11T03:15:24.3144982Z The request channel timed out while waiting for a reply after 00:33:20. Increase the timeout value passed to the call 
2021-08-11T03:15:24.3146154Z to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a 
2021-08-11T03:15:24.3147072Z portion of a longer timeout. => The HTTP request to 
2021-08-11T03:15:24.3148509Z 'https://xxx.crm6.dynamics.com/XRMServices/2011/Organization.svc/web?SDKClientVersion=9.0.45.2156' has 
2021-08-11T03:15:24.3150425Z exceeded the allotted timeout of 00:33:20. The time allotted to this operation may have been a portion of a longer 
2021-08-11T03:15:24.3151306Z timeout. => The operation has timed out
2021-08-11T03:15:24.3154044Z At D:\a\xxx\pipeline\export-solution.ps1:46 char:1
2021-08-11T03:15:24.3155600Z + Export-CrmSolution -SolutionName $SolutionName -conn $CrmSourceConnec ...
2021-08-11T03:15:24.3156650Z + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-08-11T03:15:24.3157569Z     + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
2021-08-11T03:15:24.3160456Z     + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Export-CrmSolution
2021-08-11T03:15:24.3162249Z  
2021-08-11T03:15:24.3583838Z ##[error]Process completed with exit code 1.

I've increased the timeout but I suspect that the failure is actually occurring before then. The intermittent nature is the confusing part.

Is this the most up to date end-point?
https://xxx.crm6.dynamics.com/XRMServices/2011/Organization.svc/web?SDKClientVersion=9.0.45.2156

I can confirm that the exported files are showing as downloaded but its not being caught by command:
export

@seanmcne
Copy link
Owner

Can you try setting the timeout on connection instead? I don't think your timeout is being honored based on the log it looks like it's being set after the connection, due to the way the MS dev team handles the timeout setting it requires that setting prior to establishing a connection:
image

Here's an example:

Connect-CrmOnline -ClientSecret $clientSecret -OAuthClientId $clientId -ServerUrl $url -ConnectionTimeoutInSeconds 300 

@Shikha1405
Copy link

Hi seanmcne,

I am getting the warning as below after creating the connection:
WARNING: Please reconnect to the service after setting the connection timeout or the new timeout will not be used for
operations.

When import/publish cmdlet runs, many a times i am not getting an response, can you help?
here is my code:

Write-Verbose "Creating Test Crm Connection" -Verbose
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
$TestConnection = Connect-CrmOnline -Credential $cred -ServerUrl $TargetUrl
Set-CrmConnectionTimeout -conn $TestConnection -TimeoutInSeconds 3000

Write-Verbose "Importing Solution to $TargetfriendlyName" -Verbose
Import-CrmSolution -conn $TestConnection -SolutionFilePath "$SolutionFilePath$SolutionName.zip"
Write-Verbose "Solution Imported" -Verbose

@seanmcne
Copy link
Owner

Try this, the module will update to the right TLS version now also you can set the connection timeout on connection to take care of it (otherwise you have to connect, set the timeout, and then connect again).

You can also import using an async job to upload it as a system job and poll for success or failure.

Hope that helps!
Sean

Write-Verbose "Creating Test Crm Connection" -Verbose
Connect-CrmOnline -Credential $cred -ServerUrl $TargetUrl -forceOAuth -ConnectionTimeoutInSeconds 3000 

Write-Verbose "Importing Solution to $TargetfriendlyName" -Verbose
Import-CrmSolution -SolutionFilePath "$SolutionFilePath$SolutionName.zip"
Write-Verbose "Solution Imported" -Verbose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants