You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
CodespacesYour development environment, in the cloud. Run VS Code and code on GitHub's cloud platform,Question
1 participant
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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