SAP-samples / btp-bridge-framework

Create a Microsoft Teams extension app to SAP S/4HANA with JSON configuration.
Apache License 2.0
5 stars 5 forks source link

Error in "npm start" and deploy of backend application #27

Closed ChanchalAgrawalMiku closed 1 year ago

ChanchalAgrawalMiku commented 1 year ago

Hi,

I am facing the following error during command "npm start" and also during deploy of backend application to BTP during manual deployment.

user: backend $ npm start

> bridge-framework-backend@1.0.0 start
> node app.js

[2023-08-01T15:14:56.414Z] ERROR    Error: 2 validation issue(s)

  Issue #0: invalid_type at connectionString
  Required

  Issue #1: invalid_type at containerName
  Required

    at new ZodError (/home/user/projects/btp-bridge-framework/backend/node_modules/zod/lib/src/ZodError.js:40:28)
    at ZodObject.parse (/home/user/projects/btp-bridge-framework/backend/node_modules/zod/lib/src/parser.js:190:17)
    at new BlobsStorage (/home/user/projects/btp-bridge-framework/backend/node_modules/botbuilder-azure-blobs/lib/blobsStorage.js:71:79)
    at Object.<anonymous> (/home/user/projects/btp-bridge-framework/backend/bots/botActivityHandler.js:550:17)
    at Module._compile (node:internal/modules/cjs/loader:1165:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1219:10)
    at Module.load (node:internal/modules/cjs/loader:1043:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1067:19)
    at require (node:internal/modules/cjs/helpers:103:18)

Please suggest what could be the issue.

Br, Chanchal

AFK-Python commented 1 year ago

Hi Chanchal,

Before continuing with specifics, were you able to setup the resources needed for Bridge in Azure? My suspicion is that the blob storage resource was not correctly setup. To verify this, please check the instructions below for further debugging:

Please check the value of your blob storage container name in Azure. If you search for and click on "Storage accounts" in the Azure AD (active directory) bar, you should see a list of storage accounts. Please click on the one created for Bridge during setup. Then on the left hand side of the storage account you should see a section called "Data storage", click on "Containers" directly underneath it. Here all of the created containers should be listed by name. Ensure the one you created is there. This should match the value of the containerName, if you were to log it in the backend.

Also, please check the value of your connectionString in Azure. You can find this value by navigating to your blob storage account and then selecting "Access Keys" (it is under the "Security + networking" section) from the side bar. After clicking on it, you should see "key1" and "key2". Both should have valid values for the connection string, and one of them should match the value of the connectionString in the backend. Note: I would not paste the values of these strings here, unless you intended to delete the resource and start fresh.

Best, Alex

ChanchalAgrawalMiku commented 1 year ago

Hi Alex,

Yes, I have set up the resources in Azure (but might not have entered the values in backend file in BAS). I have now noted down the values of the containerName and connectionString. Please suggest if we need to enter these two values in .env file in backend.

In .env file, there is one field connectionName, please suggest if we should enter connectionString here. Also please suggest which field will be used for containerName in .env file.

# MS BOT app credentials
MicrosoftAppId=
MicrosoftAppPassword=
connectionName=

Br, Chanchal

AFK-Python commented 1 year ago

Hi Chanchal,

There should be a section in the .env that looks like this:

#Azure blob storage
MICROSOFT_BLOB_CONNECTION_STRING=<connection_string_value>
MICROSOFT_BLOB_CONTAINER_NAME=<contianer_name>

Please add your values there, and don't forget to re-push the backend to update its environment. Note, I believe that either of your connection string values should work, but I am not 100% which is correct as this process is normally automated and I do not know which value Pwsh/TF uses.

Best, Alex

ChanchalAgrawalMiku commented 1 year ago

Thank you. #Azure blob storage parameter helped. These parameters are not mentioned to be added in .env file under manual deployment guide. It would be good to add it.