Azure / azure-functions-core-tools

Command line tools for Azure Functions
MIT License
1.32k stars 433 forks source link

Clean up "Can't determine project language" and AspNetCore messages #2831

Open johnpapa opened 2 years ago

johnpapa commented 2 years ago

When I run func start I get these messages. Not sure how to get rid of them

func start
Can't determine project language from files. Please use one of [--csharp, --javascript, --typescript, --java, --python, --powershell, --custom]
Can't determine project language from files. Please use one of [--csharp, --javascript, --typescript, --java, --python, --powershell, --custom]
Can't determine project language from files. Please use one of [--csharp, --javascript, --typescript, --java, --python, --powershell, --custom]

Azure Functions Core Tools
Core Tools Version: 3.0.3904 Commit hash: c345f7140a8f968c5dbc621f8a8374d8e3234206 (64-bit)
Function Runtime Version: 3.3.1.0

Can't determine project language from files. Please use one of [--csharp, --javascript, --typescript, --java, --python, --powershell, --custom]
Can't determine project language from files. Please use one of [--csharp, --javascript, --typescript, --java, --python, --powershell, --custom]
[2021-11-15T15:39:03.091Z] Cannot create directory for shared memory usage: /dev/shm/AzureFunctions
[2021-11-15T15:39:03.092Z] System.IO.FileSystem: Access to the path '/dev/shm/AzureFunctions' is denied. Operation not permitted.
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/2 POST http://127.0.0.1:53520/AzureFunctionsRpcMessages.FunctionRpc/EventStream application/grpc
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
Executing endpoint 'gRPC - /AzureFunctionsRpcMessages.FunctionRpc/EventStream'
[2021-11-15T15:39:04.615Z] Worker process started and initialized.

Then I tried running func init as per @anthonychu . I entered these values and got these results

▶func init
Select a number for worker runtime:
1. dotnet
2. dotnet (isolated process)
3. node
4. python
5. powershell
6. custom
Choose option: 3
node
Select a number for language:
1. javascript
2. typescript
Choose option: 1
javascript
package.json already exists. Skipped!
.gitignore already exists. Skipped!
host.json already exists. Skipped!
local.settings.json already exists. Skipped!
Writing /Users/papa/_git/shopathome/api/.vscode/extensions.json

It seems nothing changed except it added an extension recommendation. The odd language messages persist.

So I ran func start --javascript and the messages go away, kind of ...


func start --javascript
Azure Functions Core Tools
Core Tools Version: 3.0.3904 Commit hash: c345f7140a8f968c5dbc621f8a8374d8e3234206 (64-bit)
Function Runtime Version: 3.3.1.0
[2021-11-15T15:42:38.680Z] Cannot create directory for shared memory usage: /dev/shm/AzureFunctions
[2021-11-15T15:42:38.681Z] System.IO.FileSystem: Access to the path '/dev/shm/AzureFunctions' is denied. Operation not permitted.
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/2 POST http://127.0.0.1:54437/AzureFunctionsRpcMessages.FunctionRpc/EventStream application/grpc
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
Executing endpoint 'gRPC - /AzureFunctionsRpcMessages.FunctionRpc/EventStream'
[2021-11-15T15:42:40.105Z] Worker process started and initialized.

And for this, it is quite confusing as a javascript dev to see AspNetCore messages.

Sharing as per chat with Anthony Chu.

ejizba commented 2 years ago

Can't determine project language from files. Please use one of [--csharp, --javascript, --typescript, --java, --python, --powershell, --custom]

I can repro this when running func start with Node 16 (related to https://github.com/Azure/azure-functions-core-tools/issues/2830). First of all, it should never print multiple times in a row. Second of all, we can determine the language, we just can't run the project because the worker failed. We should improve the error-handling in this case.

Cannot create directory for shared memory usage: /dev/shm/AzureFunctions System.IO.FileSystem: Access to the path '/dev/shm/AzureFunctions' is denied. Operation not permitted. info: Microsoft.AspNetCore.Hosting.Diagnostics[1]

This is a known issue that has been fixed, but it may not have been released yet. See https://github.com/Azure/azure-functions-core-tools/pull/2802

Request starting HTTP/2 POST http://127.0.0.1:53520/AzureFunctionsRpcMessages.FunctionRpc/EventStream application/grpc info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint 'gRPC - /AzureFunctionsRpcMessages.FunctionRpc/EventStream'

Not sure if this is related to the /dev/shm warning. Needs investigating

anthonychu commented 2 years ago

I think there are 2 items to track here.

The ASP.NET logs are different. Looks like it might be related to some recent changes around gRPC. Not sure if it's a fix in the host or if we can should be addressing in Core Tools. Agree with @johnpapa that it's not a great thing to see, especially for non-.NET customers.

Agree with this. Would love to get smarter about language detection. Also related to helping customers create local.settings.json when it's missing.

I can repro this when running func start with Node 16 (related to #2830). First of all, it should never print multiple times in a row. Second of all, we can determine the language, we just can't run the project because the worker failed. We should improve the error-handling in this case.

BluMichele commented 1 year ago

check local.settings.json might be missing or be an invalid json