douxiong2001 2018-03-15 15:31
浏览 58
已采纳

为什么AWS Elastic beantalk无法构建我的应用程序?

I have an app written in Go, which I attempted to deploy to EB. When trying to access it, I get an Error 502 from nginx, presumably because the app is not running.

Looking at logs, I get a lot of errors like

14:01:29 build.1 | application.go:10:2: cannot find package "github.com/aws/aws-sdk-go/aws" in any of:
14:01:29 build.1 |  /opt/elasticbeanstalk/lib/go/src/github.com/aws/aws-sdk-go/aws (from $GOROOT)
14:01:29 build.1 |  /var/app/current/src/github.com/aws/aws-sdk-go/aws (from $GOPATH)

Despite the fact, that I have all of my dependencies included in the application bundle under a vendor subdirectory. How come EB does not use vendoring? According to the dashboard, it is running Go 1.9, so vendoring should be supported.

  • 写回答

1条回答 默认 最新

  • douduan4116 2018-03-15 15:33
    关注

    You need to set your GOPATH in your EBS to the root of your project directory, assuming there is a src directory where your vendor directory is located.

    For instance, pretend this is your project structure:

    app/
        src/
            vendor/
    

    And pretend that project is located in ~/home, which makes its location ~/home/app.

    Then your GOPATH should be set to ~/home/app. Go will attempt to access the dependencies through $GOPATH/src/vendor.


    But if this were the kind of structure you were using before, then you would need to have your GOPATH updated during local development as well, so if you aren't already doing that then I imagine you're using a different kind of setup... this solution, however, will work as long as your project is structured as I described above.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置