Azure / Azure/Azure-Functions

Migration from V3 to V4 throws unexpected error message

Open
#2,246 2 comments 0 reactions 1 assignee Claimed by @Ved2806 View on GitHub
Needs: Triage (functions) v4-bug
Dominant language
PowerShell
Stars
1.1k
Forks
215
Avg merge
4h 2m
Merged PRs (30d)
1

Description

Function App name: NodeJS
Tools used:
New V4 app or existing V3 app migrated to V4: V3 migrated to V4 + Node16

So, I migrated a function app V3 to V4 and upgraded my node version from 14 to 16. Everything seems to be working, however there's a misleading error message that it's getting thrown with the setup that I had on each request done to the function app.

I created a fully working playground where you could check the issue. Steps to run the demo:

1. extract zip
2. npm install
3. add a valid app insights connection string inside local.settings.json
4. npm start
5. POST / GET request to localhost:7075/api/demo

Issue: each function app request will log this message
![image](https://user-images.githubusercontent.com/8641630/183016318-f41e8964-d552-443e-83f7-672ae9a2a226.png)

My findings:

1. If I remove application insights connection string and no client will be instantiated, function runs without the error message
2. I suspect something inside app insights wrap with correlation context / app insights flush doesn't play well with Function App V4.

https://github.com/microsoft/ApplicationInsights-node.js#azure-functions code for context propagating http trigger was inspired from here

**Sample code**
[function-app-playground.zip](https://github.com/Azure/Azure-Functions/files/9266024/function-app-playground.zip)

Let me know if you need any guidance, or if I'm doing something wrong within the project. The separation of func.ts and index.ts was purely to separate business logic from distributed tracing.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.