首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >阿波罗联邦无法获得在坞库中运行的连接-撰写:无法加载服务定义for...reason: ECONNREFUSED 127.0.0.1:80

阿波罗联邦无法获得在坞库中运行的连接-撰写:无法加载服务定义for...reason: ECONNREFUSED 127.0.0.1:80
EN

Stack Overflow用户
提问于 2020-06-24 20:53:17
回答 1查看 2.9K关注 0票数 2

我试图运行两个应用程序的港口-撰写,但没有成功,联邦无法连接服务。两人都在码头外工作得很好。

以下是项目的后续行动:

  • 阿波罗服务器联盟( NodeJS

)

Kotlin + Spring + expediagroup:graphql-kotlin-spring-server中的

  • GraphQL API

docker-compose.yml

代码语言:javascript
复制
version: '3'
services:
  myservice:
    image: 'myservice:0.0.1-SNAPSHOT'
    container_name: myservice_container
    ports:
      - 8080:8080
    expose:
      - 8080
  apollo_federation:
    image: 'apollo-federation'
    build: '.'
    container_name: apollo_federation_container
    restart: always
    ports:
      - 4000:4000
    expose:
      - 4000
    environment:
      ENDPOINT: "http://myservice/graphql"
    depends_on:
      - myservice

我已经在端点ex中尝试了许多组合:http://myservice:8080/graphqlhttp://localhost:8080/graphqlhttp://myservice等等.

index.js来自阿波罗计划

代码语言:javascript
复制
const { ApolloServer } = require("apollo-server");
const { ApolloGateway } = require("@apollo/gateway");

const gateway = new ApolloGateway({
  serviceList: [
    { name: "Service1", url: process.env.ENDPOINT || 'http://localhost:8080/graphql' },
  ]
});

const server = new ApolloServer({
  gateway,
  subscriptions: false
});

server.listen().then(({ url }) => {
  console.log(` Server ready at ${url}`);
})

错误日志

代码语言:javascript
复制
 Error checking for changes to service definitions: Couldn't load service definitions for "Service1" at http://myservice/graphql: request to http://myservice/graphql failed, reason: connect ECONNREFUSED 172.18.0.3:80

如果我尝试从浏览中进行测试,我就会得到一个错误500。

我已经尝试使用nginx作为反向代理,但没有成功。

我在项目中使用的是最后一个子类。

谢谢

EN

回答 1

Stack Overflow用户

发布于 2020-07-06 23:40:03

在代码中,您正在使用

代码语言:javascript
复制
    { name: "Service1", url: process.env.ENDPOINT || 'http://localhost:8080/graphql' },

它正在拖动process.env.ENDPOINT,它在您的停靠-撰写文件中定义为使用端口80:

代码语言:javascript
复制
    environment:
      ENDPOINT: "http://myservice/graphql" # This is port 80
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62563924

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档