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

v4 model non-string route parameters are undefined #285

Closed
e-karlsson opened this issue Jul 4, 2024 · 10 comments · Fixed by #288
Closed

v4 model non-string route parameters are undefined #285

e-karlsson opened this issue Jul 4, 2024 · 10 comments · Fixed by #288
Assignees
Labels
bug Something isn't working
Milestone

Comments

@e-karlsson
Copy link

We are migrating from v3 to v4 currently and have reached a critical problem. It seems like the routing does not work with numbers/int.

I took the basic example for Docs: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=python-v2%2Cisolated-process%2Cnodejs-v4%2Cfunctionsv2&pivots=programming-language-typescript#customize-the-http-endpoint

We can see that the category is resolving perfectly fine, but the id is undefined.

import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions';

export async function httpTrigger1(request: HttpRequest, context: InvocationContext): Promise<HttpResponseInit> {
  console.log(request.params); // { category: 'books' }
  const category = request.params.category; // books
  const id = request.params.id; // undefined

  return { body: `Category: ${category}, ID: ${id}` }; // Category: books, ID: undefined
}

app.http('httpTrigger1', {
    methods: ['GET'],
    authLevel: 'anonymous',
    route: 'products/{category:alpha}/{id:int?}',
    handler: httpTrigger1,
});

No matter if I remove the route constraint it still is undefined.

System:

Azure Functions Core Tools
Core Tools Version:       4.0.5858 Commit hash: N/A +f9ca1cc1f385317a558bc35b3a3fc96af22665e4 (64-bit)
Function Runtime Version: 4.834.3.22875
@kshyju kshyju transferred this issue from Azure/azure-functions-core-tools Jul 9, 2024
@ejizba
Copy link
Contributor

ejizba commented Jul 9, 2024

Hi @e-karlsson, this appears to be working for me:

Screenshot 2024-07-09 at 11 51 19 AM

Screenshot 2024-07-09 at 11 51 12 AM

Can you confirm which version of the @azure/functions npm package you're on?

@e-karlsson
Copy link
Author

Hi @ejizba ! Thank you for taking the time. Very interesting. Here is the version I have in the package.json file:
"@azure/functions": "^4.0.0".

Also, I am running on Mac if that can make any difference here.

@ejizba
Copy link
Contributor

ejizba commented Jul 15, 2024

Yeah I'm on a mac as well. If you check your package-lock.json file, it should display the specific version of the npm package being used. For example:

"node_modules/@azure/functions": {
"version": "4.5.0",

Could you send screenshots of what you're doing? It might allow me to catch a difference.

@e-karlsson
Copy link
Author

e-karlsson commented Jul 16, 2024

Hm, that's odd.. Yeah sure, see below:

image

What do you mean with screenshots of what I am doing? I posted the example code above:
image

Any additional files that are of interest? My colleagues meets the same problem.

npm and node version:

➜  test-folder git:(main) ✗ npm -v
10.8.1
➜  test-folder git:(main) ✗ node --version
v20.15.0

@ejizba
Copy link
Contributor

ejizba commented Jul 16, 2024

Yeah two more things:

  • A screenshot of sending the request - are you using curl? The browser? Postman? etc.
  • The full logs from func start (above you just had the version info)

@e-karlsson
Copy link
Author

Hi.

See full logs below. Generated by first func start --verbose and then trigger a call with Postman. Tried through browser also, same result. The code that is executed is the one on top. No other functions. The project was generated by Visual Studio Code extension for Azure Function app, and the code taken from MS documentation.

➜  test-folder git:(main) ✗ func start --verbose
SkipInProcessHost compilation symbol is not defined.
FUNCTIONS_INPROC_NET8_ENABLED app setting is not enabled in local.settings.json

                  %%%%%%
                 %%%%%%
            @   %%%%%%    @
          @@   %%%%%%      @@
       @@@    %%%%%%%%%%%    @@@
     @@      %%%%%%%%%%        @@
       @@         %%%%       @@
         @@      %%%       @@
           @@    %%      @@
                %%
                %


Azure Functions Core Tools
Core Tools Version:       4.0.5858 Commit hash: N/A +f9ca1cc1f385317a558bc35b3a3fc96af22665e4 (64-bit)
Function Runtime Version: 4.834.3.22875

[2024-07-17T07:40:59.552Z] Building host: version spec: , startup suppressed: 'False', configuration suppressed: 'False', startup operation id: '819c6fba-adaa-45d7-86b4-0a44d95a39dc'
[2024-07-17T07:40:59.612Z] Reading host configuration file '/Users/user1/Documents/repos/test-folder/host.json'
[2024-07-17T07:40:59.614Z] Host configuration file read:
[2024-07-17T07:40:59.614Z] {
[2024-07-17T07:40:59.614Z]   "version": "2.0",
[2024-07-17T07:40:59.614Z]   "logging": {
[2024-07-17T07:40:59.614Z]     "applicationInsights": {
[2024-07-17T07:40:59.614Z]       "samplingSettings": {
[2024-07-17T07:40:59.614Z]         "isEnabled": true,
[2024-07-17T07:40:59.614Z]         "excludedTypes": "Request"
[2024-07-17T07:40:59.614Z]       }
[2024-07-17T07:40:59.614Z]     }
[2024-07-17T07:40:59.614Z]   },
[2024-07-17T07:40:59.614Z]   "extensionBundle": {
[2024-07-17T07:40:59.614Z]     "id": "Microsoft.Azure.Functions.ExtensionBundle",
[2024-07-17T07:40:59.614Z]     "version": "[4.*, 5.0.0)"
[2024-07-17T07:40:59.614Z]   }
[2024-07-17T07:40:59.614Z] }
[2024-07-17T07:40:59.670Z] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language: python
[2024-07-17T07:40:59.710Z] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language: java
[2024-07-17T07:40:59.712Z] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language: powershell
[2024-07-17T07:40:59.725Z] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at /Users/user1/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle
[2024-07-17T07:40:59.726Z] Found a matching extension bundle at /Users/user1/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/4.17.0
[2024-07-17T07:40:59.752Z] Loading functions metadata
[2024-07-17T07:40:59.756Z] Worker indexing is enabled
[2024-07-17T07:40:59.768Z] Fetching metadata for workerRuntime: node
[2024-07-17T07:40:59.768Z] Reading functions metadata (Worker)
[2024-07-17T07:41:00.048Z] Worker f1dfbe74-6215-48a5-aa6f-3ded65e5ba16 connecting on 127.0.0.1:50164
[2024-07-17T07:41:00.309Z] Worker f1dfbe74-6215-48a5-aa6f-3ded65e5ba16 received WorkerInitRequest
[2024-07-17T07:41:00.418Z] Loading entry point file "dist/src/index.js"
[2024-07-17T07:41:00.418Z] Loaded entry point file "dist/src/index.js"
[2024-07-17T07:41:00.418Z] HTTP streaming enabled.

[2024-07-17T07:41:00.418Z] Loading entry point file "dist/src/functions/httpTrigger1.js"
[2024-07-17T07:41:00.419Z] Setting Node.js programming model to "@azure/functions" version "4.5.0"
[2024-07-17T07:41:00.419Z] Loaded entry point file "dist/src/functions/httpTrigger1.js"
[2024-07-17T07:41:00.610Z] Worker f1dfbe74-6215-48a5-aa6f-3ded65e5ba16 received FunctionsMetadataRequest
[2024-07-17T07:41:00.643Z] 1 functions found (Worker)
[2024-07-17T07:41:00.661Z] 1 functions loaded
[2024-07-17T07:41:00.664Z] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at /Users/user1/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle
[2024-07-17T07:41:00.664Z] Found a matching extension bundle at /Users/user1/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/4.17.0
[2024-07-17T07:41:00.664Z] Fetching information on versions of extension bundle Microsoft.Azure.Functions.ExtensionBundle available on https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/index.json
[2024-07-17T07:41:04.342Z] Skipping bundle download since it already exists at path /Users/user1/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/4.17.0
[2024-07-17T07:41:04.347Z] Loading extension bundle from /Users/user1/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/4.17.0/bin
[2024-07-17T07:41:04.347Z] Script Startup resetting load context with base path: '/Users/user1/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/4.17.0/bin'.
[2024-07-17T07:41:04.364Z] Reading host configuration file '/Users/user1/Documents/repos/test-folder/host.json'
[2024-07-17T07:41:04.364Z] Host configuration file read:
[2024-07-17T07:41:04.364Z] {
[2024-07-17T07:41:04.364Z]   "version": "2.0",
[2024-07-17T07:41:04.364Z]   "logging": {
[2024-07-17T07:41:04.364Z]     "applicationInsights": {
[2024-07-17T07:41:04.364Z]       "samplingSettings": {
[2024-07-17T07:41:04.364Z]         "isEnabled": true,
[2024-07-17T07:41:04.364Z]         "excludedTypes": "Request"
[2024-07-17T07:41:04.364Z]       }
[2024-07-17T07:41:04.364Z]     }
[2024-07-17T07:41:04.364Z]   },
[2024-07-17T07:41:04.364Z]   "extensionBundle": {
[2024-07-17T07:41:04.364Z]     "id": "Microsoft.Azure.Functions.ExtensionBundle",
[2024-07-17T07:41:04.364Z]     "version": "[4.*, 5.0.0)"
[2024-07-17T07:41:04.364Z]   }
[2024-07-17T07:41:04.364Z] }
[2024-07-17T07:41:04.864Z] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language: python
[2024-07-17T07:41:04.866Z] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language: java
[2024-07-17T07:41:04.866Z] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language: powershell
[2024-07-17T07:41:05.047Z] Initializing Warmup Extension.
[2024-07-17T07:41:05.137Z] Initializing Host. OperationId: '819c6fba-adaa-45d7-86b4-0a44d95a39dc'.
[2024-07-17T07:41:05.154Z] Host initialization: ConsecutiveErrors=0, StartupCount=1, OperationId=819c6fba-adaa-45d7-86b4-0a44d95a39dc
[2024-07-17T07:41:05.260Z] LoggerFilterOptions
[2024-07-17T07:41:05.260Z] {
[2024-07-17T07:41:05.260Z]   "MinLevel": "None",
[2024-07-17T07:41:05.260Z]   "Rules": [
[2024-07-17T07:41:05.260Z]     {
[2024-07-17T07:41:05.260Z]       "ProviderName": null,
[2024-07-17T07:41:05.260Z]       "CategoryName": null,
[2024-07-17T07:41:05.260Z]       "LogLevel": null,
[2024-07-17T07:41:05.260Z]       "Filter": "<AddFilter>b__0"
[2024-07-17T07:41:05.260Z]     },
[2024-07-17T07:41:05.261Z]     {
[2024-07-17T07:41:05.261Z]       "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider",
[2024-07-17T07:41:05.261Z]       "CategoryName": null,
[2024-07-17T07:41:05.261Z]       "LogLevel": "None",
[2024-07-17T07:41:05.261Z]       "Filter": null
[2024-07-17T07:41:05.261Z]     },
[2024-07-17T07:41:05.261Z]     {
[2024-07-17T07:41:05.261Z]       "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider",
[2024-07-17T07:41:05.261Z]       "CategoryName": null,
[2024-07-17T07:41:05.261Z]       "LogLevel": null,
[2024-07-17T07:41:05.261Z]       "Filter": "<AddFilter>b__0"
[2024-07-17T07:41:05.261Z]     },
[2024-07-17T07:41:05.261Z]     {
[2024-07-17T07:41:05.261Z]       "ProviderName": "Azure.Functions.Cli.Diagnostics.ColoredConsoleLoggerProvider",
[2024-07-17T07:41:05.261Z]       "CategoryName": null,
[2024-07-17T07:41:05.261Z]       "LogLevel": null,
[2024-07-17T07:41:05.261Z]       "Filter": "<AddFilter>b__0"
[2024-07-17T07:41:05.261Z]     }
[2024-07-17T07:41:05.261Z]   ]
[2024-07-17T07:41:05.261Z] }
[2024-07-17T07:41:05.261Z] LoggerFilterOptions
[2024-07-17T07:41:05.261Z] {
[2024-07-17T07:41:05.261Z]   "MinLevel": "None",
[2024-07-17T07:41:05.261Z]   "Rules": [
[2024-07-17T07:41:05.261Z]     {
[2024-07-17T07:41:05.261Z]       "ProviderName": null,
[2024-07-17T07:41:05.261Z]       "CategoryName": null,
[2024-07-17T07:41:05.261Z]       "LogLevel": null,
[2024-07-17T07:41:05.261Z]       "Filter": "<AddFilter>b__0"
[2024-07-17T07:41:05.262Z]     },
[2024-07-17T07:41:05.262Z]     {
[2024-07-17T07:41:05.262Z]       "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider",
[2024-07-17T07:41:05.262Z]       "CategoryName": null,
[2024-07-17T07:41:05.262Z]       "LogLevel": "None",
[2024-07-17T07:41:05.262Z]       "Filter": null
[2024-07-17T07:41:05.262Z]     },
[2024-07-17T07:41:05.262Z]     {
[2024-07-17T07:41:05.262Z]       "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider",
[2024-07-17T07:41:05.262Z]       "CategoryName": null,
[2024-07-17T07:41:05.262Z]       "LogLevel": null,
[2024-07-17T07:41:05.262Z]       "Filter": "<AddFilter>b__0"
[2024-07-17T07:41:05.262Z]     },
[2024-07-17T07:41:05.262Z]     {
[2024-07-17T07:41:05.262Z]       "ProviderName": "Azure.Functions.Cli.Diagnostics.ColoredConsoleLoggerProvider",
[2024-07-17T07:41:05.262Z]       "CategoryName": null,
[2024-07-17T07:41:05.262Z]       "LogLevel": null,
[2024-07-17T07:41:05.262Z]       "Filter": "<AddFilter>b__0"
[2024-07-17T07:41:05.262Z]     }
[2024-07-17T07:41:05.262Z]   ]
[2024-07-17T07:41:05.262Z] }
[2024-07-17T07:41:05.262Z] LanguageWorkerOptions
[2024-07-17T07:41:05.262Z] {
[2024-07-17T07:41:05.262Z]   "WorkerConfigs": [
[2024-07-17T07:41:05.262Z]     {
[2024-07-17T07:41:05.262Z]       "Description": {
[2024-07-17T07:41:05.262Z]         "Language": "node",
[2024-07-17T07:41:05.262Z]         "DefaultRuntimeName": null,
[2024-07-17T07:41:05.262Z]         "DefaultRuntimeVersion": null,
[2024-07-17T07:41:05.262Z]         "SupportedArchitectures": null,
[2024-07-17T07:41:05.263Z]         "SupportedOperatingSystems": null,
[2024-07-17T07:41:05.263Z]         "SupportedRuntimeVersions": null,
[2024-07-17T07:41:05.263Z]         "SanitizeRuntimeVersionRegex": null,
[2024-07-17T07:41:05.263Z]         "WorkerIndexing": "true",
[2024-07-17T07:41:05.263Z]         "Extensions": [
[2024-07-17T07:41:05.263Z]           ".js",
[2024-07-17T07:41:05.263Z]           ".mjs",
[2024-07-17T07:41:05.263Z]           ".cjs"
[2024-07-17T07:41:05.263Z]         ],
[2024-07-17T07:41:05.263Z]         "UseStdErrorStreamForErrorsOnly": false,
[2024-07-17T07:41:05.263Z]         "DefaultExecutablePath": "node",
[2024-07-17T07:41:05.263Z]         "DefaultWorkerPath": "/usr/local/Cellar/azure-functions-core-tools@4/4.0.5858/workers/node/dist/src/nodejsWorker.js",
[2024-07-17T07:41:05.263Z]         "WorkerDirectory": "/usr/local/Cellar/azure-functions-core-tools@4/4.0.5858/workers/node",
[2024-07-17T07:41:05.263Z]         "Arguments": [],
[2024-07-17T07:41:05.263Z]         "WorkerArguments": null
[2024-07-17T07:41:05.263Z]       },
[2024-07-17T07:41:05.263Z]       "Arguments": {
[2024-07-17T07:41:05.263Z]         "ExecutablePath": "node",
[2024-07-17T07:41:05.263Z]         "ExecutableArguments": [],
[2024-07-17T07:41:05.263Z]         "WorkerPath": "/usr/local/Cellar/azure-functions-core-tools@4/4.0.5858/workers/node/dist/src/nodejsWorker.js",
[2024-07-17T07:41:05.263Z]         "WorkerArguments": []
[2024-07-17T07:41:05.263Z]       },
[2024-07-17T07:41:05.263Z]       "CountOptions": {
[2024-07-17T07:41:05.263Z]         "SetProcessCountToNumberOfCpuCores": false,
[2024-07-17T07:41:05.263Z]         "ProcessCount": 1,
[2024-07-17T07:41:05.263Z]         "MaxProcessCount": 10,
[2024-07-17T07:41:05.263Z]         "ProcessStartupInterval": "00:00:10",
[2024-07-17T07:41:05.263Z]         "ProcessStartupTimeout": "00:01:00",
[2024-07-17T07:41:05.263Z]         "InitializationTimeout": "00:02:00",
[2024-07-17T07:41:05.263Z]         "EnvironmentReloadTimeout": "00:02:00",
[2024-07-17T07:41:05.264Z]         "ProcessRestartInterval": "00:00:10",
[2024-07-17T07:41:05.264Z]         "ProcessShutdownTimeout": "00:00:10"
[2024-07-17T07:41:05.264Z]       }
[2024-07-17T07:41:05.264Z]     }
[2024-07-17T07:41:05.264Z]   ]
[2024-07-17T07:41:05.264Z] }
[2024-07-17T07:41:05.264Z] ConcurrencyOptions
[2024-07-17T07:41:05.264Z] {
[2024-07-17T07:41:05.264Z]   "DynamicConcurrencyEnabled": false,
[2024-07-17T07:41:05.264Z]   "MaximumFunctionConcurrency": 500,
[2024-07-17T07:41:05.264Z]   "CPUThreshold": 0.8,
[2024-07-17T07:41:05.264Z]   "SnapshotPersistenceEnabled": true
[2024-07-17T07:41:05.264Z] }
[2024-07-17T07:41:05.264Z] FunctionResultAggregatorOptions
[2024-07-17T07:41:05.264Z] {
[2024-07-17T07:41:05.264Z]   "BatchSize": 1000,
[2024-07-17T07:41:05.264Z]   "FlushTimeout": "00:00:30",
[2024-07-17T07:41:05.264Z]   "IsEnabled": true
[2024-07-17T07:41:05.264Z] }
[2024-07-17T07:41:05.264Z] SingletonOptions
[2024-07-17T07:41:05.264Z] {
[2024-07-17T07:41:05.264Z]   "LockPeriod": "00:00:15",
[2024-07-17T07:41:05.264Z]   "ListenerLockPeriod": "00:00:15",
[2024-07-17T07:41:05.264Z]   "LockAcquisitionTimeout": "10675199.02:48:05.4775807",
[2024-07-17T07:41:05.264Z]   "LockAcquisitionPollingInterval": "00:00:05",
[2024-07-17T07:41:05.264Z]   "ListenerLockRecoveryPollingInterval": "00:01:00"
[2024-07-17T07:41:05.264Z] }
[2024-07-17T07:41:05.265Z] ScaleOptions
[2024-07-17T07:41:05.265Z] {
[2024-07-17T07:41:05.265Z]   "ScaleMetricsMaxAge": "00:02:00",
[2024-07-17T07:41:05.265Z]   "ScaleMetricsSampleInterval": "00:00:10",
[2024-07-17T07:41:05.265Z]   "MetricsPurgeEnabled": true,
[2024-07-17T07:41:05.265Z]   "IsTargetScalingEnabled": true,
[2024-07-17T07:41:05.265Z]   "IsRuntimeScalingEnabled": false
[2024-07-17T07:41:05.265Z] }
[2024-07-17T07:41:05.268Z] Starting JobHost
[2024-07-17T07:41:05.276Z] Starting Host (HostId=c02f82lxml7h-1792276392, InstanceId=5034a29e-8f4e-495f-91cf-33626e8f701c, Version=4.834.3.22875, ProcessId=8435, AppDomainId=1, InDebugMode=False, InDiagnosticMode=False, FunctionsExtensionVersion=(null))
[2024-07-17T07:41:05.302Z] Loading functions metadata
[2024-07-17T07:41:05.302Z] Worker indexing is enabled
[2024-07-17T07:41:05.302Z] Fetching metadata for workerRuntime: node
[2024-07-17T07:41:05.302Z] Reading functions metadata (Worker)
[2024-07-17T07:41:05.326Z] Reading functions metadata (Custom)
[2024-07-17T07:41:05.348Z] 1 functions found (Custom)
[2024-07-17T07:41:05.364Z] 1 functions loaded
[2024-07-17T07:41:05.441Z] Generating 1 job function(s)
[2024-07-17T07:41:05.444Z] Worker process started and initialized.
[2024-07-17T07:41:05.447Z] Worker f1dfbe74-6215-48a5-aa6f-3ded65e5ba16 received FunctionLoadRequest
[2024-07-17T07:41:05.527Z] Found the following functions:
[2024-07-17T07:41:05.528Z] Host.Functions.httpTrigger1
[2024-07-17T07:41:05.528Z] 
[2024-07-17T07:41:05.544Z] HttpOptions
[2024-07-17T07:41:05.544Z] {
[2024-07-17T07:41:05.544Z]   "DynamicThrottlesEnabled": false,
[2024-07-17T07:41:05.544Z]   "EnableChunkedRequestBinding": false,
[2024-07-17T07:41:05.544Z]   "MaxConcurrentRequests": -1,
[2024-07-17T07:41:05.544Z]   "MaxOutstandingRequests": -1,
[2024-07-17T07:41:05.544Z]   "RoutePrefix": "api"
[2024-07-17T07:41:05.544Z] }
[2024-07-17T07:41:05.546Z] Initializing function HTTP routes
[2024-07-17T07:41:05.546Z] Mapped function route 'api/products/{category:alpha}/{id:int?}' [GET] to 'httpTrigger1'
[2024-07-17T07:41:05.546Z] 
[2024-07-17T07:41:05.565Z] Host initialized (268ms)
[2024-07-17T07:41:05.572Z] Host started (293ms)
[2024-07-17T07:41:05.573Z] Job host started

Functions:

        httpTrigger1: [GET] http://localhost:7071/api/products/{category:alpha}/{id:int?}

[2024-07-17T07:41:10.281Z] Host lock lease acquired by instance ID '0000000000000000000000003219BFCE'.
[2024-07-17T07:41:28.155Z] Executing HTTP request: {
[2024-07-17T07:41:28.155Z]   "requestId": "426634ed-2adb-4210-ac98-2b43010af0a5",
[2024-07-17T07:41:28.155Z]   "method": "GET",
[2024-07-17T07:41:28.156Z]   "userAgent": "PostmanRuntime/7.40.0",
[2024-07-17T07:41:28.156Z]   "uri": "/api/products/books/5"
[2024-07-17T07:41:28.156Z] }
[2024-07-17T07:41:28.439Z] Executing 'Functions.httpTrigger1' (Reason='This function was programmatically called via the host APIs.', Id=fe4ad3f8-39b1-42ea-9a26-c12aee61369f)
[2024-07-17T07:41:28.607Z] { category: 'books' }
[2024-07-17T07:41:28.634Z] Worker f1dfbe74-6215-48a5-aa6f-3ded65e5ba16 received FunctionInvocationRequest with invocationId fe4ad3f8-39b1-42ea-9a26-c12aee61369f
[2024-07-17T07:41:28.717Z] Executed 'Functions.httpTrigger1' (Succeeded, Id=fe4ad3f8-39b1-42ea-9a26-c12aee61369f, Duration=324ms)
[2024-07-17T07:41:28.757Z] Executed HTTP request: {
[2024-07-17T07:41:28.757Z]   "requestId": "426634ed-2adb-4210-ac98-2b43010af0a5",
[2024-07-17T07:41:28.757Z]   "identities": "",
[2024-07-17T07:41:28.757Z]   "status": "200",
[2024-07-17T07:41:28.757Z]   "duration": "601"
[2024-07-17T07:41:28.757Z] }
image

Just to clarify the problem, I did a request also with endpoint http://localhost:7071/api/products/books/05, then it works as it see 05 as a string..

[2024-07-17T07:43:07.860Z] Executing HTTP request: {
[2024-07-17T07:43:07.860Z]   "requestId": "beef9a6d-29a4-475c-954d-ec428bdd399f",
[2024-07-17T07:43:07.860Z]   "method": "GET",
[2024-07-17T07:43:07.860Z]   "userAgent": "PostmanRuntime/7.40.0",
[2024-07-17T07:43:07.860Z]   "uri": "/api/products/books/05"
[2024-07-17T07:43:07.860Z] }
[2024-07-17T07:43:07.861Z] Executing 'Functions.httpTrigger1' (Reason='This function was programmatically called via the host APIs.', Id=79c2200a-ab20-41d0-8a2c-11051688f8a4)
[2024-07-17T07:43:07.864Z] Worker f1dfbe74-6215-48a5-aa6f-3ded65e5ba16 received FunctionInvocationRequest with invocationId 79c2200a-ab20-41d0-8a2c-11051688f8a4
[2024-07-17T07:43:07.865Z] { category: 'books', id: '05' }
[2024-07-17T07:43:07.868Z] Executed 'Functions.httpTrigger1' (Succeeded, Id=79c2200a-ab20-41d0-8a2c-11051688f8a4, Duration=6ms)
[2024-07-17T07:43:07.868Z] Executed HTTP request: {
[2024-07-17T07:43:07.868Z]   "requestId": "beef9a6d-29a4-475c-954d-ec428bdd399f",
[2024-07-17T07:43:07.868Z]   "identities": "",
[2024-07-17T07:43:07.868Z]   "status": "200",
[2024-07-17T07:43:07.868Z]   "duration": "7"
[2024-07-17T07:43:07.868Z] }

@ejizba
Copy link
Contributor

ejizba commented Jul 17, 2024

Okay, I figured out our difference! Projects created recently will have a new http stream feature enabled by default (more info here), but older projects (like I was testing on) will not. I can repro the issue with http streaming turned on and will look into a fix. Thanks for reporting!

In the meantime, you can workaround this by turning http streaming off. In your src/index.ts file you can either change enableHttpStream to false or remove the call to app.setup altogether

@ejizba ejizba added bug Something isn't working and removed Needs: Attention 👋 labels Jul 17, 2024
@ejizba ejizba self-assigned this Jul 22, 2024
@ejizba ejizba changed the title Function app v4 TypeScript route parameters v4 model non-string route parameters are undefined Jul 22, 2024
@ejizba ejizba transferred this issue from Azure/azure-functions-nodejs-worker Jul 31, 2024
@e-karlsson
Copy link
Author

Hi @ejizba ! I have confirmed another issue with enableHttpStream enabled. When this setting is set to true and then deployed to Azure Functions, the calls are not being redirected internally in the app correctly. Hence, the requests timeouts. The problem was raised with MS support but I found the solution after your suggestion here.

@ejizba
Copy link
Contributor

ejizba commented Aug 6, 2024

Hi @e-karlsson, please file a new issue with detailed repro steps

@ejizba
Copy link
Contributor

ejizba commented Aug 28, 2024

Hi @e-karlsson we just released a fix in v4.5.1. Thanks for your help!

FYI @emilselroos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants