Why does my API GET request work fine in Postman but returns a 404 in Node when used in Pipedream?

This topic was automatically generated from Slack. You can find the original thread here.

I have an API GET request working fine in Postman, but when I convert it to Node in Pipedream the endpoint returns a 404. Am I missing something? I have other endpoints in pipedream for this same service on different endpoints so I feel like Im missing something. TIA! Here’s the code:

// To use any npm package, just import it
// import axios from "axios"
import { axios } from "@pipedream/platform";

export default defineComponent({
async run({ steps, $ }) {
const domainAccountsResponse = await axios($, {
url: 'https://api.dmarcreport.com/v2/accounts/17333/domain_accounts',
headers: {
"Authorization": Token token=${process.env.DMARCReport}``
}
})
console.log(domainAccountsResponse)
},
})

The URL in the request looks correct according to this API doc: API documentation

Maybe that account ID 17333 doesn’t exist?

Thanks yes I agree. I’ve double checked everything. The same URL using 17333 works in postman this is why I find this odd.

I’ve asked the vendor and they say there is no issue, they also said they tried it in pipedream, but provided no evidence as such.

Hmm maybe then the process.env.DMARCReport env var is not returning properly?

Could you try to log it?

// To use any npm package, just import it
// import axios from “axios”
import { axios } from “@pipedream/platform”;

export default defineComponent({
async run({ steps, $ }) {

console.log(process.env.DMARCReport);

const domainAccountsResponse = await axios($, {
  url: 'https://api.dmarcreport.com/v2/accounts/17333/domain_accounts',
  headers: {
    "Authorization": `Token token=${process.env.DMARCReport}`
  }
})
console.log(domainAccountsResponse)

},
})

Does anything show in the logs? (don’t post it here)

yes it does - redacted here

I use this same code / context / process.env in other functions in other places on other endpoints at this vendor. It’s the first time I’ve tried this particular end point.

Gotcha

Yeah weird, the code you shared is absolutely 100% correct, so I wonder what’s the issue here

If you’d like I can look further into it asap, submit a support ticket here: Support - Pipedream

Thanks I will. I’ve pushed back on the vendor too to look deeper

Btw you can also request an integration with Dmarc Report here:

So instead of using environment variables for the token you can use our native app integration

All good thanks!