Skip to content

Commit

Permalink
Bug/65517 axios requests failing to talk to azure functions API (#2937)
Browse files Browse the repository at this point in the history
* default to ipv4

* configure ipv4 globally for axios

---------

Co-authored-by: Mohsen Qureshi <[email protected]>
  • Loading branch information
GuyHarwood and activemq authored Oct 24, 2024
1 parent 9242bbc commit be628d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions admin/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ const pupilStatus = require('./routes/pupil-status')
const websiteOffline = require('./routes/website-offline')
const techSupport = require('./routes/tech-support')
const roles = require('./lib/consts/roles')
// globally configure ipv4 for all axios request uses...
const axios = require('axios')
const http = require('http')
axios.defaults.httpAgent = new http.Agent({ family: 4 })

setupBrowserSecurity(app)

Expand Down
2 changes: 1 addition & 1 deletion admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"watch:integration": "yarn jest --watch --coverage=no --config ./tests-integration/jest.integration.config.js"
},
"mtc": {
"assets-version": "6a569a48061e8e7844eee749fb4527b3"
"assets-version": "5eb463baa90e81b0b79de4acfc4a8096"
},
"engines": {
"node": ">= 18"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

const sqlService = require('./sql.service')
const R = require('ramda')
const axios = require('axios')
const config = require('../../config')
const axios = require('axios')

const functionUrl = `${config.Functions.Throttled.BaseAdminUrl}/sync-results-init`
const requestConfig = {
Expand Down Expand Up @@ -32,7 +32,7 @@ const service = {
},

callSyncResultsInitFunction: async function callSyncResultsInitFunction (message) {
const response = await axios.post(functionUrl, { input: JSON.stringify(message) }, requestConfig)
const response = await axios.post(functionUrl, message, requestConfig)
if (response.status !== 202) {
throw new Error(`request to ${functionUrl} failed: ${response.status} - ${response.statusText}`)
}
Expand Down

0 comments on commit be628d7

Please sign in to comment.