jaewonhimnae / chatbot-app

45 stars 37 forks source link

Cannot read property 'charCodeAt' of undefined #32

Open fitwist opened 3 years ago

fitwist commented 3 years ago

Unable to launch express server via 'npm run start'.

{ "name": "chatbot-app", "version": "1.0.0", "description": "chatbot-app", "main": "index.js", "engines": { "node": "10.15.0", "npm": "6.9.0" }, "scripts": { "start": "node index.js", "backend": "nodemon index.js", "frontend": "npm run front --prefix client", "dev": "concurrently \"npm run backend\" \"npm run start --prefix client\"" }, "author": "Jaewon Ahn", "license": "ISC", "dependencies": { "actions-on-google": "^2.6.0", "body-parser": "^1.18.3", "dialogflow": "^0.8.2", "dialogflow-fulfillment": "^0.6.1", "express": "^4.17.1", "mongoose": "^5.4.20" }, "devDependencies": { "concurrently": "^4.1.0", "nodemon": "^1.18.10" } }

Maybe, it is helpful: in order to install express, I removed package-lock.json.

fitwist commented 3 years ago

Hard-coding 'const projectId = 'test-chat-bot-app-321808' didn't help. 'const projectId = process.env.GCP_PROJECT || process.env.GCLOUD_PROJECT' either.

fitwist commented 3 years ago

key.json: { "type": "service_account", "project_id": "test-chat-bot-app-321808", "private_key_id": "d1eea17c739f1869541d87fec30cd6ecd01c4c83", "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n", "client_email": "chat-bot-app-test@test-chat-bot-app-321808.iam.gserviceaccount.com", "client_id": "109871563487861484894", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/chat-bot-app-test%40test-chat-bot-app-321808.iam.gserviceaccount.com" }

fitwist commented 3 years ago

hardcoding all of the credentials finally helped me:

const projectId = 'test-chat-bot-app-321808'
const sessionId = 'bot-session'
const languageCode = 'en-US'