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

Node JS function v4 #1139

Open
abaudhuin opened this issue Apr 13, 2023 · 15 comments
Open

Node JS function v4 #1139

abaudhuin opened this issue Apr 13, 2023 · 15 comments

Comments

@abaudhuin
Copy link

abaudhuin commented Apr 13, 2023

Is your feature request related to a problem? Please describe.
I'm trying to deploy a function located in /api. I'm using nodeJS and I'm using the new version v4 to define code my function.
It looks like it not working. I can't reach my function when using v4 but I can when using v3.
The type of function I'm talking about: https://techcommunity.microsoft.com/t5/apps-on-azure-blog/azure-functions-version-4-of-the-node-js-programming-model-is-in/ba-p/3773541

Describe the solution you'd like
I would like to be able to use functions v4

Describe alternatives you've considered
Maybe it's already possible in some way. But since I don't have any errors I don't know what to look for.

@diberry
Copy link

diberry commented Apr 24, 2023

In the portal, I configured the SWA managed API to include the v4 config setting ( "AzureWebJobsFeatureFlags": "EnableWorkerIndexing" )but got an error.

image

When I followed the link, it seems like I'm not able to set the AzureWeb prefixed setting.

image

Perhaps this is the problem. But what is the fix.

@offbeatful
Copy link

Any updates to this? The linked issue says that the flag requirement will go away. Any insights on that?

@guidoffm
Copy link

I am facing this problem, too. With the 4.x programming model no deployed api is recognized by the Azure portal. When I am trying to access the api I get a 404.
The build complains about wrong Node version. So I added a file staticwebapp.config.json with the content

 {
    "platform": {
        "apiRuntime": "node:18"
    }
}

Getting the same error when I am trying to set the setting. Is this needed? Can I set this setting in source code?

@guidoffm
Copy link

When I use the command to upload the local settings from VS Code then it says the setting for AzureWebJobsFeatureFlags is excluded.

@guidoffm
Copy link

I guess v4 is not supported with SWA yet and both the documentation and the tools are misleading.

@offbeatful
Copy link

I was able to run it in West US region.

@guidoffm
Copy link

guidoffm commented Aug 1, 2023

Indeed, this works for me, too, on US West 2. Interesting. But it seems Microsoft does not have so many resources to work on this project.

@ameinhardt
Copy link

For development and the time being, I created a simple custom managed v3 http proxy (fetch() with functions request data without host, connection header to path of x-ms-original-url) to a stand-alone v4 functions host. With a "/api/*" rewrite to this proxy function in staticwebapp.config.json it forwards simple requests (and appends code= auth)

@fiveisprime
Copy link
Member

Hey there! Sorry for the problems and the lack of communication on my part. I've been working with Dina internally and can provide a bit of an update here.

The V4 functions model is changing to no longer require the environment variables, which will light up SWA support as it rolls out. Right now, it's only been rolled out to West US 2 and it's coming to the other regions over time. I'll have to contact the Functions team to verify the timing, but this is on the way and will continue to light up more regions with support for the V4 model.

I'll update here when I have more concrete information and dates.

@thammons
Copy link

I'll update here when I have more concrete information and dates.

Any news on this? :)

v4 is GA!
...but unfortunately I'm not seeing much help from Bing with getting my SWA (with managed functions) to not throw 404's when using the v4 model.

My project's azfunc-v4 branch anxiously awaits your reply XD

@balbany
Copy link

balbany commented Oct 16, 2023

I'll update here when I have more concrete information and dates.

Any news on this? :)

v4 is GA! ...but unfortunately I'm not seeing much help from Bing with getting my SWA (with managed functions) to not throw 404's when using the v4 model.

My project's azfunc-v4 branch anxiously awaits your reply XD

+1. Same issue with BYO Function App (v4 results in 404's). Works fine in local dev (with the SWA CLI) of course...

@thammons
Copy link

+1. Same issue with BYO Function App (v4 results in 404's). Works fine in local dev (with the SWA CLI) of course...

Took me a while to find it.. but @azure/functions is no longer a devdependancy... and it's hosted!

Doublecheck your settings from the migration guide?
https://learn.microsoft.com/en-us/azure/azure-functions/functions-node-upgrade-v4?tabs=v4

@balbany
Copy link

balbany commented Oct 16, 2023

+1. Same issue with BYO Function App (v4 results in 404's). Works fine in local dev (with the SWA CLI) of course...

Took me a while to find it.. but @azure/functions is no longer a devdependancy... and it's hosted!

Doublecheck your settings from the migration guide? https://learn.microsoft.com/en-us/azure/azure-functions/functions-node-upgrade-v4?tabs=v4

What do you mean by "it's hosted"? I've got the package as a straight dependency, but I'm wondering if it might be a problem with running from zip... anyway nearly finished recreating everything in West US 2, so will see if that makes a difference...

@thammons
Copy link

"It's hosted" meaning it deployed to azure and running/responding as expected.

I'm using Azure functions as the API on a Static Web App (managed) in East US 2, so probably not very relevant to your setup.

@shibayan
Copy link

shibayan commented Dec 9, 2023

In regions (e.g eastasia) where the Azure Functions Runtime version has been updated to 4.28.2, EnableWorkerIndexing is enabled by default, so we have confirmed that the new programming model Function will work.

However, the APIs on Azure Portal seem to be a little strange at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants