Azure / azure-functions-dotnet-worker-preview

MIT License
65 stars 19 forks source link

Error when deploy to Azure #36

Open mgwilliam opened 3 years ago

mgwilliam commented 3 years ago

I've followed the instructions in the README to deploy to Azure (UK South)

When I run this command:

az functionapp create --resource-group my-net5funcs-rg --consumption-plan-location uksouth --runtime dotnet --functions-version 3 --name my-net5funcs-app --storage-account mynet5funcsstorage

I get this warning:

--runtime-version is not supported for --runtime dotnet. Dotnet version is determined by --functions-version. Dotnet version will be 3.1 for this function app

Undeterred, I carried on and when I run this command:

func azure functionapp publish my-net5funcs-app

I get this error:

Your app has an unknown FUNCTIONS_WORKER_RUNTIME defined 'None'. Only dotnet, node, python, powershell, custom are supported.

My local settings is identical to the one in this repo - the runtime is set to dotnet-isolated

I have this version of Azure Functions Core Tools:

Core Tools Version:       3.0.3233 Commit hash: d1772f733802122a326fa696dd4c086292ec0171
Function Runtime Version: 3.0.15193.0

Has anyone been able to deploy to Azure?

alexanderbikk commented 3 years ago

@mgwilliam Hi I got the same issue and the following response from console

"You can pass --force to update your Azure app with 'None' as a 'FUNCTIONS_WORKER_RUNTIME'"

So just add -- force

  func azure functionapp publish my-net5funcs-app --force

Should work

Here is my response image

But then I got error like this. And my function is not working I got 503 image

chris-oswald commented 3 years ago

@alexanderbikk, the instructions are pretty clear the runtime needs to be set to "dotnet-isolated". Maybe I'm missing something obvious on why it would be set to None.

alexanderbikk commented 3 years ago

@chris-oswald Actually you are right and the runtime should be dotnet-isoleated. But why during deployment I got the error that my local runtime is set to "None"? This is the issue I believe image

So If I use --force it allows to publish but the function will not working obviously. My bad.

chris-oswald commented 3 years ago

@alexanderbikk , on the local dev side you need to run "func host start --verbose". I use visual studio and the debugger doesn't work from the IDE. The command above works for me - it's in the readme docs for more details.

alexanderbikk commented 3 years ago

@chris-oswald I don't have a problem with local deployment. I have the same issue that @mgwilliam has when deploying the function to Azure. Please check my screenshot above.

Azure Functions Core Tools

Core Tools Version:       3.0.3284 Commit hash: 98bc25e668274edd175a1647fe5a9bc4ffb6887d
Function Runtime Version: 3.0.15371.0
alexanderbikk commented 3 years ago

Finally, I found the issue. My local.settings.json file wasn't copied to publish directory(it was only in Debug and the function worked locally).

If you getting the same issue during deployment to Azure just make sure that you always copy the local.settigs.json in the publish directory

image

image

chris-oswald commented 3 years ago

@alexanderbikk sorry for not paying attention. Did you get your .Net 5 app running in Azure?

alexanderbikk commented 3 years ago

@alexanderbikk sorry for not paying attention. Did you get your .Net 5 app running in Azure?

Just read my previous post :) I did it, just make sure that your local.settigs.json is copied to publish directory and publish to Azure will be succeeded. This was my mistake and I believe @mgwilliam got the same issue.

MetaFight commented 3 years ago

I think local.settings.json is deliberately ignored during deployments. You should be using host.json for your deployment config instead.