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

modal pop up after clicking button

1  Asked on August 19, 2020 by ashmoe

         

How to import react libraries into pure jsx file

0  Asked on August 17, 2020 by dannycranfield

       

Style changing with JS not responding

0  Asked on August 14, 2020 by alessandro

       

Can’t use saved information to load into an array

1  Asked on August 13, 2020 by danny

         

How to return pointer adress for structure variable

2  Asked on August 9, 2020 by mystheman

 

Merging two PDF generating views in Django

1  Asked on August 8, 2020 by piethon

       

How do you put a list inside of an object C#?

1  Asked on August 8, 2020 by forrest

     

How to modify this C++ class to be as efficient as C code?

1  Asked on August 7, 2020 by victor-canoz

   

Ask a Question

Get help from others!

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