Unexpected end of file (node)

hello, in the last days I get email that my workflow has error on every execution. I did not change anything in the code, it was working perfectly before.

I use email + nodejs code workflow

The code does what I want, no problems but I get this error, idk why.

image
It seems like axios problem


I import axios in code like this import axios from "axios";

Hello @anondev,

First off, welcome to the Pipedream community. Happy to have you!

By default, Pipedream will install the latest versions of a packages you define in the the Node.js code step.

I believe you may be experiencing the same issue reported here by other Axios users:

I suggest trying their recommendations, either by downgrading to axios@1.1.3 or defining the encoding headers manually on your request:

const { data = await axios({
  method: 'GET',
  url: 'YOUR URL",
  headers: { "Accept-Encoding": "gzip,deflate,compress" } 
});
2 Likes

Hi @anondev,

I can confirm that downgrading to axios@1.1.3 resolves the issue for me:

// To use any npm package on Pipedream, just import it
import axios from "axios@1.1.3"

export default defineComponent({
  async run({ steps, $ }) {
    const { data } = await axios({
      method: "GET",
      url: "https://pokeapi.co/api/v2/pokemon/charizard",
    })
    return data.species
  },
})

2 Likes

Thanks it really works

Minor update, we had manually pinned axios on Pipedream to v1.1.3 because of this issue on v1.2.0.

However, the axios team released a new version v1.2.1 that did not solve the underlying bug, effectively removing our pin.

We have repinned to version v1.1.3 to rollback this broken feature.