Skip to content

Conversation

@bakoushin
Copy link
Contributor

@bakoushin bakoushin commented Feb 25, 2025

Setting an allbridge request header similar to the official SDK in an attempt to get rid of the 403 response

Context: https://valora-app.slack.com/archives/C02N3AR2P2S/p1740482746542719

Copy link
Contributor

@kathaypacific kathaypacific left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🪵

(options) => {
logger.debug('allbridge: request details', {
url: options.url.toString(),
headers: options.headers,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't use any api tokens / authentication in the headers that could be logged here right?

Comment on lines 103 to 136
hooks: {
beforeRequest: [
(options) => {
logger.debug('allbridge: request details', {
url: options.url.toString(),
headers: options.headers,
method: options.method,
})
},
],
beforeError: [
(error) => {
logger.error('allbridge: request error', {
statusCode: error.response?.statusCode,
statusMessage: error.response?.statusMessage,
responseHeaders: error.response?.headers,
responseBody: error.response?.body,
url: error.options?.url?.toString(),
requestHeaders: error.options?.headers,
})
return error
},
],
afterResponse: [
(response) => {
logger.debug('allbridge: response received', {
statusCode: response.statusCode,
headers: response.headers,
})
return response
},
],
},
})
Copy link
Member

Comment on lines 54 to 64
? client
.readContract({
address: tokenInfo.poolAddress,
abi: poolAbi,
functionName: 'balanceOf',
args: [address as Address],
})
.catch((e) => {
logger.error('allbridge: failed to fetch balanceOf', e)
throw e
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this?

@bakoushin bakoushin changed the title chore: allbridge error logging chore: refine allbridge header Feb 25, 2025
Copy link
Member

@jeanregisser jeanregisser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 🚀

.get('https://core.api.allbridgecoreapi.net/token-info')
.get('https://core.api.allbridgecoreapi.net/token-info', {
headers: {
'x-Sdk-Agent': 'AllbridgeCoreSDK/0.0.0-development', // as in https://github.com/allbridge-io/allbridge-core-js-sdk/blob/5deb0623d6fffcbc7a85dba22b98942c47d4af6c/src/client/core-api/api-client.ts#L48
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the shipped libs have a real value: 3.21.0 for the latest version
https://www.npmjs.com/package/@allbridge/bridge-core-sdk?activeTab=code

Screenshot 2025-02-25 at 14 58 36

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, thanks!

@bakoushin bakoushin enabled auto-merge (squash) February 25, 2025 14:01
@bakoushin bakoushin merged commit fc8ce81 into main Feb 25, 2025
5 checks passed
@bakoushin bakoushin deleted the alex/allbridge-logging branch February 25, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants