AnswerBun.com

pymongo.errors.OperationFailure: Authentication failed when deploying chatbot on Heroku

Stack Overflow Asked on January 3, 2022

I tried to deployed a chatbot which involves the application of MongoDB but I am stuck by this bug all day (figure 1). I cannot what is wrong because I follow the doc strictly and check the config vars over and over again to make sure all of them are correct. Can anyone give me some suggestions? I just ran out of options. Here is a snippet of codes:

ACCESS_TOKEN = os.environ['ACCESS_TOKEN']
VERIFY_TOKEN = os.environ['VERIFY_TOKEN']
MONGODB_URI = os.environ['MONGODB_URI']
db = MongoClient(MONGODB_URI).get_database()
collection = db.get_collection('QnA')
time = datetime.fromtimestamp(int(str(message['timestamp'])[:-3])).strftime(
    '%Y-%m-%d %H:%M:%S')
collection.insert_one({"question": message['message'].get('text'),
                       "answer": response, 'time': time})

enter image description here

One Answer

It turned out to be just a stupid question because of my carelessness. The data is not authenticated to be inserted until I add the IP of facebook messenger into the whitelist of my project. This can be referred to this link.

Answered by Memphis Meng on January 3, 2022

Add your own answers!

Related Questions

How to determine the number of negation words per sentence

2  Asked on January 3, 2021 by user14289862

   

Scala getClass.getResource() returning null

4  Asked on January 3, 2021 by tower

     

Use background image instead of border

1  Asked on January 2, 2021 by user3808307

   

Appended messages collides with previous data

1  Asked on January 2, 2021 by nancy-mooree

   

My gRPC-Test Project just work on localhost

1  Asked on January 2, 2021 by blindmeis

     

URL constructor appends ‘/’ at the end of the url

0  Asked on January 2, 2021 by ayusch-jain

         

Using the AWS EC2 Query API

1  Asked on January 2, 2021 by xliff

     

guidata not updating in MATLAB GUI

3  Asked on January 2, 2021 by matias-andina

       

Change long click delay

7  Asked on January 1, 2021 by fhucho

   

Dynamic parameters startWith Rxjs

1  Asked on January 1, 2021 by luden

     

Passing variables from a HTML form to PHP

2  Asked on January 1, 2021 by jim-r

     

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir