Skip to content

Commit

Permalink
Fix confusing debug log, improve warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Siegrift committed Oct 1, 2023
1 parent ffe473a commit 39ee09a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion packages/pusher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ The pusher needs a configuration in order to run. The `config` folder contains e
To start the the pusher in dev mode run the following:

1. `cp pusher.example.json pusher.json` - To copy the pusher configuration from the example. Note, the `pusher.json`
file is ignored by git.
file is ignored by git. If you are using Docker Desktop, you need to change the URL from localhost to
`host.docker.internal`. For example:

```jsonc
"url": "http://host.docker.internal:8090"
```

2. `cp secrets.example.env secrets.env` - To copy the secrets.env needed for the configuration. This file is also
ignored by git.
3. Set the `NODARY_API_KEY` inside the secrets file. Ask someone from development team for the key.
Expand Down
8 changes: 4 additions & 4 deletions packages/pusher/src/api-requests/signed-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ export const postSignedApiData = async (group: SignedApiNameUpdateDelayGroup) =>
} = getState();
const { signedApiName, templateIds, updateDelay } = group;
const logContext = { signedApiName, updateDelay };
logger.debug('Posting signed API data.', { group, ...logContext });

const provider = signedApis.find((a) => a.name === signedApiName)!;

const airnode = ethers.Wallet.fromMnemonic(airnodeWalletMnemonic).address;
const batchPayloadOrNull = templateIds.map((templateId): SignedApiPayload | null => {
Expand All @@ -36,6 +33,9 @@ export const postSignedApiData = async (group: SignedApiNameUpdateDelayGroup) =>
logger.debug('No batch payload found to post. Skipping.', logContext);
return { success: true, count: 0 };
}

logger.debug('Posting signed API data.', { group, ...logContext });
const provider = signedApis.find((a) => a.name === signedApiName)!;
const goAxiosRequest = await go<Promise<unknown>, AxiosError>(async () => {
logger.debug('Posting batch payload.', { ...logContext, batchPayload });
const axiosResponse = await axios.post(provider.url, batchPayload, {
Expand All @@ -50,7 +50,7 @@ export const postSignedApiData = async (group: SignedApiNameUpdateDelayGroup) =>
logger.warn(
`Failed to make update signed API request.`,
// See: https://axios-http.com/docs/handling_errors
{ ...logContext, axiosResponse: goAxiosRequest.error.response }
{ ...logContext, error: goAxiosRequest.error.response ?? goAxiosRequest.error }
);
return { success: false };
}
Expand Down

0 comments on commit 39ee09a

Please sign in to comment.