projectkudu / kudu

Kudu is the engine behind git/hg deployments, WebJobs, and various other features in Azure Web Sites. It can also run outside of Azure.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Run from package on Windows = broken node_modules symlinks

aaronadamsCA opened this issue · comments

Subscription: b525****-****-****-****-ac8f48efaf10
App name: func-*****graph-dev-03

This function is currently failing to execute with the following error message:

[Error] Executed 'Functions.graphql' (Failed, Id=0fca6076-990b-4275-b8cc-8c6b8a08c10d, Duration=14ms)
Result: Failure
Exception: Worker was unable to load function graphql: 'SyntaxError: Unexpected token '.''
Stack: C:\home\site\wwwroot\node_modules\@xxxxxxxxx\env:1
../../packages/env
^SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:979:16)
at Module._compile (internal/modules/cjs/loader.js:1027:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\home\site\wwwroot\graphql\authentication\shopify-authentication.js:4:15)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)

The file at C:\home\site\wwwroot\node_modules\@xxxxxxxxx\env should be a symbolic link to ../../packages/env, but it appears Node.js is attempting to parse the contents of the symlink instead of following it.

That ZIP package is created on GitHub Actions using https://github.com/Azure/functions-action. I'm stuck using a Windows function due to Azure/functions-action#58 + lack of support for Linux consumption functions in Canada Central. So I need to figure out how to get these symlinks working as-is.

This is similar to #2946 but for Windows apps.

For now, I am successfully working around the failing symbolic links by adding the following step to my GitHub Actions workflow:

      - name: Move local packages to node_modules directory
        run: |
          rm node_modules/@xxxxxxxxx/*
          mv packages/* node_modules/@xxxxxxxxx/

This replaces the symbolic links with the packages themselves, which makes the function work again (which also confirms the problem was with the symbolic links). But obviously this is a step that shouldn't be necessary, and makes orchestrating builds more complex than it needs to be.

Hi

If the problem persists and is related to running it on Azure App Service, please open a support incident in Azure:
https://learn.microsoft.com/en-us/azure/azure-portal/supportability/how-to-create-azure-support-request

This way we can better track and assist you on this case

Thanks,

Joaquin Vano
Azure App Service