@graphprotocol/graph-cli 0.68.3 → 0.68.4-alpha-20240228184155-59a5760

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
+ ## 0.68.4-alpha-20240228184155-59a5760
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1595](https://github.com/graphprotocol/graph-tooling/pull/1595)
8
+ [`decff14`](https://github.com/graphprotocol/graph-tooling/commit/decff1435bdd3b4e459ffa83d881f23d26e2ee5f)
9
+ Thanks [@saihaj](https://github.com/saihaj)! - improve error handling for `graph deploy`
10
+
3
11
  ## 0.68.3
4
12
 
5
13
  ### Patch Changes
@@ -40,6 +40,7 @@ const network_1 = require("../command-helpers/network");
40
40
  const node_1 = require("../command-helpers/node");
41
41
  const version_1 = require("../command-helpers/version");
42
42
  const constants_1 = require("../constants");
43
+ const debug_1 = __importDefault(require("../debug"));
43
44
  const protocols_1 = __importDefault(require("../protocols"));
44
45
  const headersFlag = core_1.Flags.custom({
45
46
  summary: 'Add custom headers that will be used by the IPFS HTTP client.',
@@ -48,6 +49,7 @@ const headersFlag = core_1.Flags.custom({
48
49
  default: {},
49
50
  });
50
51
  const productOptions = ['subgraph-studio', 'hosted-service'];
52
+ const deployDebugger = (0, debug_1.default)('graph-cli:deploy');
51
53
  class DeployCommand extends core_1.Command {
52
54
  async run() {
53
55
  const { args: { 'subgraph-name': subgraphNameArg, 'subgraph-manifest': manifest }, flags: { product: productFlag, studio, 'deploy-key': deployKeyFlag, 'access-token': accessToken, 'version-label': versionLabelFlag, ipfs, headers, node: nodeFlag, 'output-dir': outputDir, 'skip-migrations': skipMigrations, watch, 'debug-fork': debugFork, network, 'network-file': networkFile, 'ipfs-hash': ipfsHash, 'from-hosted-service': hostedServiceSubgraphName, }, } = await this.parse(DeployCommand);
@@ -111,15 +113,19 @@ class DeployCommand extends core_1.Command {
111
113
  jsonRpcError,
112
114
  // @ts-expect-error TODO: why are the arguments not typed?
113
115
  res) => {
116
+ deployDebugger('requestError: %O', requestError);
117
+ deployDebugger('jsonRpcError: %O', jsonRpcError);
114
118
  if (jsonRpcError) {
115
- let errorMessage = `Failed to deploy to Graph node ${requestUrl}: ${jsonRpcError.message}`;
119
+ const message = jsonRpcError?.message || jsonRpcError?.code?.toString();
120
+ deployDebugger('message: %O', message);
121
+ let errorMessage = `Failed to deploy to Graph node ${requestUrl}: ${message}`;
116
122
  // Provide helpful advice when the subgraph has not been created yet
117
- if (jsonRpcError.message.match(/subgraph name not found/)) {
123
+ if (message?.match(/subgraph name not found/)) {
118
124
  errorMessage += `
119
125
  Make sure to create the subgraph first by running the following command:
120
126
  $ graph create --node ${node} ${subgraphName}`;
121
127
  }
122
- if (jsonRpcError.message.match(/auth failure/)) {
128
+ if (message?.match(/auth failure/)) {
123
129
  errorMessage += '\nYou may need to authenticate first.';
124
130
  }
125
131
  spinner.fail(errorMessage);
@@ -223,10 +229,14 @@ class DeployCommand extends core_1.Command {
223
229
  jsonRpcError,
224
230
  // @ts-expect-error TODO: why are the arguments not typed?
225
231
  res) => {
232
+ deployDebugger('requestError: %O', requestError);
233
+ deployDebugger('jsonRpcError: %O', jsonRpcError);
226
234
  if (jsonRpcError) {
227
- let errorMessage = `Failed to deploy to Graph node ${requestUrl}: ${jsonRpcError.message}`;
235
+ const message = jsonRpcError?.message || jsonRpcError?.code?.toString();
236
+ deployDebugger('message: %O', message);
237
+ let errorMessage = `Failed to deploy to Graph node ${requestUrl}: ${message}`;
228
238
  // Provide helpful advice when the subgraph has not been created yet
229
- if (jsonRpcError.message.match(/subgraph name not found/)) {
239
+ if (message?.match(/subgraph name not found/)) {
230
240
  if (isHostedService) {
231
241
  errorMessage +=
232
242
  '\nYou may need to create it at https://thegraph.com/explorer/dashboard.';
@@ -237,7 +247,7 @@ class DeployCommand extends core_1.Command {
237
247
  $ graph create --node ${node} ${subgraphName}`;
238
248
  }
239
249
  }
240
- if (jsonRpcError.message.match(/auth failure/)) {
250
+ if (message?.match(/auth failure/)) {
241
251
  errorMessage += '\nYou may need to authenticate first.';
242
252
  }
243
253
  spinner.fail(errorMessage);
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.68.3",
2
+ "version": "0.68.4-alpha-20240228184155-59a5760",
3
3
  "commands": {
4
4
  "add": {
5
5
  "id": "add",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/graph-cli",
3
- "version": "0.68.3",
3
+ "version": "0.68.4-alpha-20240228184155-59a5760",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {