Issues with Node Azure Functions in Codespace #116936
Replies: 1 comment
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
Hi All, I worked through this issue with copilot and it recommended i reach out to Github Customer Support but thought I would post here as well.
I developed a basic Azure Function and started it using func start. In the terminal I got the following error:
[2024-04-05T15:19:56.257Z] Worker was unable to load function DemoRequest: 'Unexpected token '??=''
[2024-04-05T15:19:56.259Z] Worker failed to load function: 'DemoRequest' with functionId: '7021b2b7-f326-440f-8e77-682015aa78ca'.
[2024-04-05T15:19:56.259Z] Result: Failure
Is this a known issue? Can anything be done to test Azure Functions within Codespace? For context here is a copilot generated recap of the troubleshooting steps taken:
The steps provided were intended to troubleshoot the specific error you were encountering, which was related to a newer JavaScript feature not being recognized by the Azure Functions runtime. However, let's review the steps taken:
Ensure Node.js version compatibility: You've confirmed that you're using Node.js v14.21.3, which supports the nullish coalescing assignment operator (??=). This was verified using the node -v command.
Update Azure Functions Core Tools: You've updated Azure Functions Core Tools to version 4 using the command npm install -g azure-functions-core-tools@4 --unsafe-perm true. This ensures you're using the latest version of the Azure Functions runtime.
Specify Node.js version in package.json: You've added the engines property to your package.json file to specify the Node.js version for your Azure Functions project. This helps ensure that the Azure Functions runtime uses the correct version of Node.js.
"engines": {
"node": "~14"
}
Specify Node.js version in local.settings.json: You've added the WEBSITE_NODE_DEFAULT_VERSION environment variable to your local.settings.json file to specify the Node.js version for your Azure Function.
"WEBSITE_NODE_DEFAULT_VERSION": "~14"
Despite these steps, the error SyntaxError: Unexpected token '??=' persists, which suggests that the Azure Functions runtime is still not recognizing the nullish coalescing assignment operator (??=).
The last proposed step was to downgrade the tedious library to a version that doesn't use the nullish coalescing assignment operator. However, this is a workaround and not an ideal solution, as it might affect other parts of your project that depend on a newer version of tedious.
At this point, I would recommend reaching out to the Azure Functions team or the GitHub Codespaces team for further assistance. They might be able to provide more insight into why the Azure Functions runtime is not recognizing the nullish coalescing assignment operator (??=) despite the Node.js version supporting it.
Beta Was this translation helpful? Give feedback.
All reactions