Hi @Mounika Chirukuri like Lex mentioned, if you don't have a specific reason for using App Service (Windows) try deploying to App Service Linux. But here are some options to get optional chaining support in Azure App Service with Node version 18:
- Upgrade the Node.js version on App Service to version 18.7.0 or higher. Optional chaining was introduced in Node 18.7.
- Use a polyfill library like optional-chaining-polyfill to add support for older Node versions. Install it as a dependency.
- Transpile your code with Babel to convert the optional chaining syntax to supported JavaScript that will work on older Node versions.
- Use JavaScript try/catch instead of optional chaining to handle potential null/undefined errors.
-Grace