微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决获取代码管道作业 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 举报,一经查实,本站将立刻删除。