获取代码管道作业 ID 时的连接超时

问题描述

我正在尝试通过 Codepipeline 调用 lambda 函数,但它在 codepipeline 阶段加载了近 1 小时。

查看我的 lambda 日志时,大约需要 20 分钟,并且我收到该错误

Connect timeout on endpoint URL: "https://codepipeline.us-west-2.amazonaws.com/": ConnectTimeoutError
Traceback (most recent call last):
  File "/var/task/lambda_function.py",line 51,in handler
    jobId=job_id
  File "/var/runtime/botocore/client.py",line 357,in _api_call
    return self._make_api_call(operation_name,kwargs)

这是我正在使用的示例代码

def handler(event,context):
    # Todo implement
    job_id = None
    response = None
    try:
        job_id = event['CodePipeline.job']['id']
        job_data = event['CodePipeline.job']['data']['actionConfiguration']['configuration']['UserParameters']
        logger.info(job_data)        
         
#    data.append("btq")

        with conn.cursor() as shop:
    #        #cur.execute(req)       
            shop.execute("select id,nom,type,numdist,secteur from boutiques where id = " + str(job_data) + " order by id asc limit 3")       
            btq = shop.fetchall()
            conn.commit()     
            
        print("Pass")
        response = codepipeline.put_job_success_result(jobId=job_id)
        return response     
        
    except ClientError as e:
        print('Function Failed due to exception.')   
        print(e)
        response = codepipeline.put_job_failure_result(
            jobId=job_id,failureDetails={
                'type': 'JobFailed','message': f'{error.__class__.__name__}: {str(error)}'
                }
            )    
        
        return 1

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...