Azure-Samples / azure-search-openai-javascript

A TypeScript sample app for the Retrieval Augmented Generation pattern running on Azure, using Azure AI Search for retrieval and Azure OpenAI and LangChain large language models (LLMs) to power ChatGPT-style and Q&A experiences.
MIT License
252 stars 130 forks source link

`azd up` fails, in the `postup` hook, which calls into Index-data.sh #176

Closed diberry closed 9 months ago

diberry commented 9 months ago

On Windows laptop....In vscode devcontainer (so Linux?) - I can't get the postup hook to complete.

Related to Issue 141.

node ➜ /workspaces/azure-search-openai-javascript (main) $ azd hooks run postup

Running hooks (azd hooks run)
Finding and executing postup hooks for environment diberry-openai-js.

  (x) Failed: Running postup command hook for project

ERROR: failed running hook postup, 'postup' hook failed with exit code: '1', Path: './scripts/index-data.sh'. : exit code: 1, stdout: Running index-data.sh
Loading azd .env file from current environment
Installing dependencies and building CLI
npm ERR! code EPERM
npm ERR! syscall chmod
npm ERR! path /workspaces/azure-search-openai-javascript/node_modules/indexer/bin/index-files.js
npm ERR! errno -1
npm ERR! Error: EPERM: operation not permitted, chmod '/workspaces/azure-search-openai-javascript/node_modules/indexer/bin/index-files.js'
npm ERR!  [Error: EPERM: operation not permitted, chmod '/workspaces/azure-search-openai-javascript/node_modules/indexer/bin/index-files.js'] {
npm ERR!   errno: -1,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'chmod',
npm ERR!   path: '/workspaces/azure-search-openai-javascript/node_modules/indexer/bin/index-files.js'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-01-31T22_00_51_212Z-debug-0.log

> indexer@1.0.0 build
> tsc

sh: 1: tsc: not found
npm ERR! Lifecycle script `build` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: indexer@1.0.0 
npm ERR!   at location: /workspaces/azure-search-openai-javascript/packages/indexer 
Running "index-files" CLI tool
node:internal/errors:496
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'commander' imported from /workspaces/azure-search-openai-javascript/packages/indexer/dist/lib/cli.js
    at new NodeError (node:internal/errors:405:5)
    at packageResolve (node:internal/modules/esm/resolve:916:9)
    at moduleResolve (node:internal/modules/esm/resolve:973:20)
    at defaultResolve (node:internal/modules/esm/resolve:1193:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:403:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:372:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:249:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:39)
    at link (node:internal/modules/esm/module_job:75:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v18.19.0
, stderr: 

If the indexer is deployed as a Container app, could this postup action move to a Container app job? It would need very few changes to move that off the local environment and into ACA.