Azure-Samples / azure-openai-rag-workshop

Create your own ChatGPT with Retrieval-Augmented-Generation workshop
https://aka.ms/ws/openai-rag
MIT License
97 stars 349 forks source link

azd deploy frontend cant deploy #34

Closed ahmedzafar89 closed 5 months ago

ahmedzafar89 commented 6 months ago

Hi thank you for the amazing workshop. Whenever I'm trying to deploy the workshop i'm getting this error in azd deploy for frontend. Backend can be deployed without any issue. Can you please help on this. Thank you.

azd deploy

Deploying services (azd deploy)

  (✓) Done: Deploying service backend
  - Endpoint: https://backend.prouddune-953d9eb4.japaneast.azurecontainerapps.io/

  |===    | Deploying service frontend (Copying deployment package)Export-ModuleMember: C:\Users\Ahmed\AppData\Local\Temp\azd-predeploy-1559059345.ps1:4
Line |
   4 |  Export-ModuleMember -Variable BACKEND_API_URI && npm run build
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The Export-ModuleMember cmdlet can only be called from inside a module.
  (x) Failed: Deploying service frontend

ERROR: failed deploying service 'frontend': failed invoking event handlers for 'predeploy', 'predeploy' hook failed with exit code: '1', Path: 'C:\Users\Ahmed\AppData\Local\Temp\azd-predeploy-1559059345.ps1'. : exit code: 1
sinedied commented 6 months ago

Thanks for the report. Could you provide us the following information to help us debug this?

ahmedzafar89 commented 5 months ago

hi, sorry for the late reply.
I was able to run the deployment after changing that line to run: $env:BACKEND_API_URI = (Get-Content ../../.env | ForEach-Object { $name, $value = $_.split('='); if ($name -eq 'BACKEND_API_URI') { $value } })[0] && npm run build Thank you