我正在尝试使用 React、NodeJS、GraphQL 和 Heroku 部署个人项目。这是我第一次使用 GraphQL,感觉有点失落。我正在做我通常在不使用 GraphQL 的情况下会做的所有事情,但是 Heroku 陷入了构建阶段。有谁知道会发生什么?非常感谢任何帮助,非常感谢!
这是我的服务器
const PORT = process.env.PORT || 3002;
const cors = require("cors");
const graphqlHTTP = require("express-graphql");
var schema = require("./schema/schema.js");
const { ApolloServer } = require("apollo-server-express");
const db = require("../mongodb/index");
const app = express();
app.use(cors());
app.use(
"/graphql",
graphqlHTTP({
schema,
graphiql: true
})
);
const server = new ApolloServer({ schema });
// console.log(server);
app.use(express.static("public"));
server.applyMiddleware({ app });
app.listen({ port: PORT }, err => {
if (err) {
console.log("there was an error", err);
} else {
console.log(`server ready at http://localhost:3002${server.graphqlPath}`);
}
});
我在 app.jsx 中的 apolloClient 看起来像这样
const client = new ApolloClient({
uri: "/graphql"
});
在我尝试使用部署之后
git push heroku master
这需要很长时间,我得到以下信息
remote: webpack is watching the files…
remote:
remote: Hash: ea7bec75c71b31ce8b50
remote: Version: webpack 4.39.2
remote: Time: 6998ms
remote: Built at: 09/03/2019 4:19:47 AM
remote: Asset Size Chunks Chunk Names
remote: bundle.js 12.4 MiB main [emitted] main
remote: Entrypoint main = bundle.js
remote: [./client/index.jsx] 182 bytes {main} [built]
remote: [./client/queries/queries.jsx] 1.68 KiB {main} [built]
remote: [./node_modules/moment/locale sync recursive ^\.\/.*$] ./node_modules/moment/locale sync ^\.\/.*$ 3 KiB {main} [optional] [built]
remote: [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 472 bytes {main} [built]
remote: [./node_modules/webpack/buildin/harmony-module.js] (webpack)/buildin/harmony-module.js 573 bytes {main} [built]
remote: [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 497 bytes {main} [built]
remote: + 873 hidden modules
error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
我无法找到有关当前问题的任何信息。有没有人遇到过 Heroku 类似的问题?
非常感谢!!