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

CmdLets should emit an Warning or error if enabled trigger does not have pipeline references #435

Open
jikuja opened this issue Dec 15, 2024 · 3 comments
Assignees
Labels
triage Issue is under investigation

Comments

@jikuja
Copy link
Contributor

jikuja commented Dec 15, 2024

Describe the bug

Enabled triggers without pipeline references are not handled properly

On UX Data Factory validation blocks publish for triggers that are enabled wihtout pipeline references:

image

  • Test-AdfCode does not generate any warning for the trigger
  • Publish-AdfV2FromJson tries to to start the trigger, fails

To Reproduce

trigger JSON

{
	"name": "fail",
	"properties": {
		"description": "Backend will fail with this",
		"annotations": [],
		"runtimeState": "Started",
		"pipelines": [
		],
		"type": "ScheduleTrigger",
		"typeProperties": {
			"recurrence": {
				"frequency": "Week",
				"interval": 1,
				"startTime": "2023-02-15T19:32:00",
				"timeZone": "FLE Standard Time",
				"schedule": {
					"minutes": [
						11
					],
					"hours": [
						5
					],
					"weekDays": [
						"Thursday",
						"Friday",
						"Monday",
						"Tuesday",
						"Wednesday"
					]
				}
			}
		}
	}
}

Test-AdfCode does not generate any warning for the trigger

Publish-AdfV2FromJson tries to to start the trigger, fails

The number of triggers to start: 9
Starting triggers:
- Enabling trigger: fail
Start-AzDataFactoryV2Trigger: /Users/janne.kujanpaa/.local/share/powershell/Modules/azure.datafactory.tools/1.11.2/private/Start-Trigger.ps1:17:13
Line |
  17 |              Start-AzDataFactoryV2Trigger `
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | HTTP Status Code: BadRequest Error Code: BadRequest Error Message: Missing or invalid pipeline references for trigger fail Request Id:
     | 7f4324c5-5f97-4acf-9777-805d34405bb5 Timestamp (Utc):12/15/2024 17:54:44
Start-AzDataFactoryV2Trigger: /Users/janne.kujanpaa/.local/share/powershell/Modules/azure.datafactory.tools/1.11.2/private/Start-Trigger.ps1:17:13
Line |
  17 |              Start-AzDataFactoryV2Trigger `
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | HTTP Status Code: BadRequest Error Code: BadRequest Error Message: Missing or invalid pipeline references for trigger fail Request Id:
     | e644ca62-59c0-42a5-9c8e-ba048608e220 Timestamp (Utc):12/15/2024 17:54:44
Start-AzDataFactoryV2Trigger: /Users/janne.kujanpaa/.local/share/powershell/Modules/azure.datafactory.tools/1.11.2/private/Start-Trigger.ps1:17:13
Line |
  17 |              Start-AzDataFactoryV2Trigger `
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | HTTP Status Code: BadRequest Error Code: BadRequest Error Message: Missing or invalid pipeline references for trigger fail Request Id:
     | abca1459-a823-4904-908f-dad36a49da36 Timestamp (Utc):12/15/2024 17:54:45
Start-AzDataFactoryV2Trigger: /Users/janne.kujanpaa/.local/share/powershell/Modules/azure.datafactory.tools/1.11.2/private/Start-Trigger.ps1:17:13
Line |
  17 |              Start-AzDataFactoryV2Trigger `
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | HTTP Status Code: BadRequest Error Code: BadRequest Error Message: Missing or invalid pipeline references for trigger fail Request Id:
     | 53b314c9-be6c-4472-a36e-85b3c1338043 Timestamp (Utc):12/15/2024 17:54:46
Start-AzDataFactoryV2Trigger: /Users/janne.kujanpaa/.local/share/powershell/Modules/azure.datafactory.tools/1.11.2/private/Start-Trigger.ps1:17:13
Line |
  17 |              Start-AzDataFactoryV2Trigger `
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | HTTP Status Code: BadRequest Error Code: BadRequest Error Message: Missing or invalid pipeline references for trigger fail Request Id:
     | 970fbf7e-59ba-4aa4-b993-c71342849ae8 Timestamp (Utc):12/15/2024 17:54:46
- Enabling trigger: Monthly - End of the Month

Expected behaviour

  • Test-AdfCode should emit an warning
  • Publish-AdfV2FromJson should have better indications of the failure to fail the running pipeline

More details

For me it looks like Start-Trigger error handling is not working like it should.

E.g. Write-Host and Write-Warning output are missing

                Write-Host "Failed starting trigger after $attempts attempts."
                Write-Warning -Message $_.Exception.Message

More details 2

Variables are empty if passing -ErrorVariable ev -WarningVariable wv to Publish-AdfV2FromJson

More details 3

Publish-AdfV2FromJson -ErrorVariable ev -WarningVariable wv -ErrorAction 'Stop' is a partial workaround to emit a failure when underlying API calls fails. As side-effect other failing code on our use-case causes early termination and triggers are not started again.

AFAIK error handling code on Start-Trigger should catch the errors when -ErrorAction 'Stop' is used

Version of PowerShell module of:

  • 1.11.2
@jikuja jikuja added the triage Issue is under investigation label Dec 15, 2024
@jikuja
Copy link
Contributor Author

jikuja commented Dec 16, 2024

The error handling of Start-AzDataFactoryV2Trigger might be following:

  • Normal invocation only prints errors into stream 2. At least I could not capture warning with -warningvariable but 2>warning.log works
  • If -ErrorAction "Stop" is being used Start-AzDataFactoryV2Trigger CmdLet emits terminating error

@jikuja
Copy link
Contributor Author

jikuja commented Jan 30, 2025

In this case ADF backend fails to enable triggers that are using Blob events becasue of missing RBAC:

Image

@NowinskiK NowinskiK self-assigned this Jan 30, 2025
@NowinskiK
Copy link
Member

Thanks @jikuja for raising this issue and describing it with so many useful details.
Let me restore my private environment to test the current behaviour and consider the best solution.

NowinskiK added a commit that referenced this issue Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Issue is under investigation
Projects
None yet
Development

No branches or pull requests

2 participants