got: Cannot read property 'includes' of undefined

Describe the bug

Hi, we use got in many microservice and yesterday we upgrade v11.5.2 to v11.7.0.

Since this upgrade we have some error

RequestError: Cannot read property 'includes' of undefined
    at /src/node_modules/got/dist/source/core/index.js:1246:38
    at Request._beforeError (/src/node_modules/got/dist/source/core/index.js:1273:11)
    at ClientRequest.<anonymous> (/src/node_modules/got/dist/source/core/index.js:959:18)
    at Object.onceWrapper (events.js:422:26)
    at ClientRequest.emit (events.js:327:22)
    at ClientRequest.origin.emit (/src/node_modules/@szmarczak/http-timer/dist/source/index.js:39:20)
    at Socket.socketErrorListener (_http_client.js:426:9)
    at Socket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at Object.calculateRetryDelay [as default] (/src/node_modules/got/dist/source/core/calculate-retry-delay.js:9:44)
    at /src/node_modules/got/dist/source/core/index.js:1236:71
    at Request._beforeError (/src/node_modules/got/dist/source/core/index.js:1273:11)
    at ClientRequest.<anonymous> (/src/node_modules/got/dist/source/core/index.js:959:18)
    at Object.onceWrapper (events.js:422:26)
    at ClientRequest.emit (events.js:327:22)
    at ClientRequest.origin.emit (/src/node_modules/@szmarczak/http-timer/dist/source/index.js:39:20)
    at Socket.socketErrorListener (_http_client.js:426:9)
    at Socket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3

Do you have any ideas why ? This related to a breaking change ?

  • Node.js version: 12
  • OS & version: Linux

Actual behavior

Throw a strange error independant of our code.

Expected behavior

Should work like v11.5.2

Checklist

  • I have read the documentation.
  • I have tried my code with the latest version of Node.js and Got.

About this issue

Most upvoted comments

Are you using options.retry? Your error seems to be due to an undefined options.retry.methods.

It could be Got that fails to merge the defaults of options.retry with your custom ones.

@MarianVasile the options aren’t renormalized. We should add this to the docs.