Azure / Azure-Functions

1.1k stars 191 forks source link

Function app name length issue #2395

Open prashantkumar-tomtom opened 12 months ago

prashantkumar-tomtom commented 12 months ago

I am facing an issue with the function app name. I created an Azure function with the name abcde-product-stats-and-release-notes-api and created a staging slot in the same. Function app name: abcde-product-stats-and-release-notes-api URL: https://abcde-product-stats-and-release-notes-api.azurewebsites.net

Slot-Name: staging URL: https://abcde-product-stats-and-release-notes-ap-staging.azurewebsites.net (last character from api is trimmed) On clicking on the URL got this image

While deploying to the staging slot using GitHub actions, got error: Error: Execution Exception (state: ValidateParameter) (step: Invocation) Error: At ValidateParameter, slot-name : SCM credential does not match slot-name staging. Please ensure the slot-name parameter has correct casing and the publish profile is acquired from your function app's slot rather than your main production site.. Error: Deployment Failed! The error message is misleading and wasted too much time debugging this.

I finally created another function app with the name abcde-product-stats-reno-api and then staging slot in the same, deployment was successful and everything is working as expected. Also found another weird thing in the deployment center is : image

Functions are deployed to the staging slot but in the message section of the logs **"slotName":"production"** which is wrong it should be staging

bhagyshricompany commented 12 months ago

Hi @prashantkumar-tomtom Use a function app name without characters that may cause conflicts in the URL, especially if using deployment slots. Ensure that you use the correct publish profile associated with the staging slot for deployment. While the deployment center might display generic information about the production slot, the actual behavior should correspond to the selected staging slot. If you have successfully deployed to the staging slot using the new function app name "abcde-product-stats-reno-api," and everything is working as expected, then it appears that you've resolved the issues related to the function app and slot deployment. Refer belowmplz.

  1. Azure Functions Documentation: https://docs.microsoft.com/azure/azure-functions/

This documentation covers various aspects of Azure Functions, including getting started, creating functions, working with triggers and bindings, using deployment slots, and more.

  1. Azure Deployment Slots Documentation: https://docs.microsoft.com/azure/app-service/deploy-staging-slots/

This documentation provides information about deployment slots in Azure App Service, which includes Azure Functions. It explains how to use deployment slots to create separate environments for staging, testing, and production, allowing you to deploy and test new versions before swapping them into production.

prashantkumar-tomtom commented 12 months ago

Please help me understand the characters who are causing conflicts in abcde-product-stats-and-release-notes-api but not in abcde-product-stats-reno-api.

For Ensure that you use the correct publish profile associated with the staging slot for deployment Yeah, I already check too many times and publish profile was correct.

For While the deployment center might display generic information about the production slot, the actual behavior should correspond to the selected staging slot Thanks for this, It might be an action item that can be taken as an improvement.

ghost commented 11 months ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

prashantkumar-tomtom commented 11 months ago

Please help me understand the characters who are causing conflicts in abcde-product-stats-and-release-notes-api but not in abcde-product-stats-reno-api.

For Ensure that you use the correct publish profile associated with the staging slot for deployment Yeah, I already check too many times and publish profile was correct.

For While the deployment center might display generic information about the production slot, the actual behavior should correspond to the selected staging slot Thanks for this, It might be an action item that can be taken as an improvement.

@bhagyshricompany I had already put my feedback and query. I am still looking for the answer to the below points.

Please help me understand the characters or Which char is causing conflicts in abcde-product-stats-and-release-notes-api but not in abcde-product-stats-reno-api.

bhagyshricompany commented 11 months ago

main diff er ence in bot function is abcde-product-stats-and-release-notes-api abcde-product-stats-reno-api The main difference between these two function app names is the inclusion of the phrase "and-release-notes" in the first name, which is not present in the second name. Based on this, we can suspect that the character causing conflicts is the hyphen ("-") between "release" and "notes." In Azure Function App names, the hyphen ("-") is used as a separator to distinguish different parts of the name. For example, in the first function app name, the hyphen is used to separate "abcde" (probably a project or company name) from "product-stats-and-release-notes-api" (the specific function app name). Based on the behavior you described, it's possible that the hyphen ("-") in the function app name is causing issues when used in combination with the staging slot. It might be worth avoiding special characters like hyphens in function app names to prevent potential conflicts.

To avoid issues and conflicts, consider using a different separator or removing special characters like hyphens from the function app name. For example, you could use an underscore ("_") or simply concatenate the different parts of the function app name without any separators, depending on your naming conventions and preferences.

bhagyshricompany commented 10 months ago

@fabiocav pls comment validate

kallem commented 3 weeks ago

I ran this issue as well.

I don't believe that problem is in conflicting characters but rather limit of URL length. My function app URL length is 46 characters. When I created slot "staging" then original function app name is truncated and slot name is appended fully. Slot URL is then 49 characters.

URL ends with "...sms-gateway-app" and slot URL ends with "gatewa-staging". So just normal characters and one dash is dropped.

URL truncation is equal to what has happened in the original descripion.

So most likely by using shorter names but that then adds naming special case which is not convinient.

Is the function app name compared to slot URL during the process because that would obviously lead to an error?