You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GitHub中Snowflake dbt连接失败问题求助

GitHub Actions中dbt连接Snowflake报"Error detecting the version of libcrypto"排查方案

问题场景

使用以下GitHub Actions YAML执行dbt Build任务:

name: dbt Build and Push

on:
  push:
    branches:
      - main

permissions:
  contents: write

jobs:
  build:
    runs-on: ubuntu-20.04

    container:
      image: xemuliam/dbt:1.5

    steps:
      - name: Check out code
        uses: actions/checkout@v3

        run: |
          dbt debug
          dbt seed
          dbt docs generate

此前任务运行正常,连接测试输出如下:

04:26:28  Connection:
04:26:28    account: myaccount
04:26:28    user: ***
04:26:28    database: mydb
04:26:28    schema: dev
04:26:28    warehouse: DBT
04:26:28    role: SYSADMIN
04:26:28    client_session_keep_alive: False
04:26:28    query_tag: None
04:26:28  Registered adapter: snowflake=1.5.2
04:26:29    Connection test: [OK connection ok]

近期未修改任何代码或配置,但任务突然失败,报错:

Connection test: [ERROR]
09:06:46  dbt was unable to connect to the specified database.
The database returned the following error:

  >Database Error
  Error detecting the version of libcrypto

本地执行dbt debug可正常连接,GitLab CI运行相同任务也无异常。

排查与解决方案

1. 公共镜像依赖更新导致不兼容

你使用的xemuliam/dbt:1.5是公共镜像,维护者可能近期更新了镜像内的依赖(如OpenSSL版本),导致与dbt-snowflake 1.5.2适配器版本冲突。

  • 解决方式:锁定镜像的具体哈希版本,避免自动更新到有问题的镜像。去Docker Hub查询该镜像的历史版本,找到此前正常运行的版本哈希,替换配置:
    container:
      image: xemuliam/dbt:1.5@sha256:xxxxxxxxx # 替换为历史正常版本的哈希值
    
  • 备选方案:改用官方维护的dbt镜像,比如ghcr.io/dbt-labs/dbt-snowflake:1.5.latest,官方镜像的依赖兼容性更稳定。

2. GitHub Runner底层环境变更

虽然指定了ubuntu-20.04运行环境,但GitHub可能对runner底层做了更新,导致容器内libcrypto依赖加载异常。

  • 解决方式:在容器内显式安装兼容版本的OpenSSL库,修改steps配置:
    steps:
      - name: Check out code
        uses: actions/checkout@v3
      - name: Install compatible OpenSSL
        run: |
          apt-get update && apt-get install -y openssl=1.1.1f-1ubuntu2.20
      - name: Run dbt commands
        run: |
          dbt debug
          dbt seed
          dbt docs generate
    
    注:需根据镜像基础系统选择对应OpenSSL版本,ubuntu-20.04默认的1.1.1版本与dbt-snowflake 1.5.2兼容。

3. dbt-snowflake适配器依赖冲突

dbt-snowflake 1.5.2对cryptography库有特定版本要求,镜像内的cryptography版本可能被更新,导致与libcrypto交互失败。

  • 解决方式:运行dbt命令前重新安装兼容版本的cryptography:
    steps:
      - name: Check out code
        uses: actions/checkout@v3
      - name: Install compatible cryptography
        run: |
          pip install cryptography==38.0.4 # 该版本与dbt-snowflake 1.5.2兼容
      - name: Run dbt commands
        run: |
          dbt debug
          dbt seed
          dbt docs generate
    

内容的提问来源于stack exchange,提问作者Saubhagya Kushwaha

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 02:35:19