Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eks: ProxyAgent is not a constructor #26771

Closed
trondhindenes opened this issue Aug 16, 2023 · 5 comments · Fixed by #26782
Closed

eks: ProxyAgent is not a constructor #26771

trondhindenes opened this issue Aug 16, 2023 · 5 comments · Fixed by #26782
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service bug This issue is a bug. p0 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@trondhindenes
Copy link

Describe the bug

The newest cdk library (2.92.0) produces this error. Downgrading to 2.90.0 solves it. We create clusters where we specify the kubectl_layer parameter.

Expected Behavior

it shouldn't fail

Current Behavior

I'm getting this error:

11:02:05 AM | CREATE_FAILED        | Custom::AWSCDK-EKS-Cluster            | clusterC5B25D0D
Received response status [FAILED] from custom resource. Message returned: ProxyAgent is not a constructor

Reproduction Steps

See descr

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.89.0

Framework Version

2.92.0

Node.js Version

v18.17.0

OS

Ubuntu

Language

Python

Language Version

Python 3.8

Other information

No response

@trondhindenes trondhindenes added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 16, 2023
@github-actions github-actions bot added the @aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service label Aug 16, 2023
@pahud
Copy link
Contributor

pahud commented Aug 16, 2023

Can you share the smallest code snippet to reproduce this error?

@pahud pahud added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. p2 and removed needs-triage This issue or PR still needs to be triaged. labels Aug 16, 2023
@juweeks
Copy link

juweeks commented Aug 16, 2023

this is also breaking my eks deployment on v2.92. reverted back to v2.91 and seems to be fixed (fwiw- the only difference on the diffs from 2.91->2.92 was the OIDC handler)

cfn error:

Received response status [FAILED] from custom resource. Message returned: ProxyAgent is not a constructor

Logs: /aws/lambda/xxxxOnEventHandler42BEBAE0-jXvWcu93ZFF4

at Object.<anonymous> (/var/task/index.js:1:417)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:110:18)
at _tryRequireFile (file:///var/runtime/index.mjs:912:37)
at _tryRequire (file:///var/runtime/index.mjs:962:25)
at _loadUserApp (file:///var/runtime/index.mjs:991:22) (RequestId: 09418d76-9c40-46da-9cfe-1d056ff8e2ad)


 ❌  xxxstack failed: Error: The stack named xxxstack failed to deploy: UPDATE_ROLLBACK_COMPLETE: Received response status [FAILED] from custom resource. Message returned: ProxyAgent is not a constructor

Logs: /aws/lambda/xxxxOnEventHandler42BEBAE0-jXvWcu93ZFF4

    at Object.<anonymous> (/var/task/index.js:1:417)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at _tryRequireFile (file:///var/runtime/index.mjs:912:37)
    at _tryRequire (file:///var/runtime/index.mjs:962:25)
    at _loadUserApp (file:///var/runtime/index.mjs:991:22) (RequestId: 09418d76-9c40-46da-9cfe-1d056ff8e2ad)
    at FullCloudFormationDeployment.monitorDeployment (/usr/local/lib/node_modules/aws-cdk/lib/index.js:426:10236)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.deployStack2 [as deployStack] (/usr/local/lib/node_modules/aws-cdk/lib/index.js:429:153380)
    at async /usr/local/lib/node_modules/aws-cdk/lib/index.js:429:137002

 ❌ Deployment failed: Error: The stack named xxxstack failed to deploy: UPDATE_ROLLBACK_COMPLETE: Received response status [FAILED] from custom resource. Message returned: ProxyAgent is not a constructor

Logs: xxxxOnEventHandler42BEBAE0-jXvWcu93ZFF4

    at Object.<anonymous> (/var/task/index.js:1:417)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at _tryRequireFile (file:///var/runtime/index.mjs:912:37)
    at _tryRequire (file:///var/runtime/index.mjs:962:25)
    at _loadUserApp (file:///var/runtime/index.mjs:991:22) (RequestId: 09418d76-9c40-46da-9cfe-1d056ff8e2ad)
    at FullCloudFormationDeployment.monitorDeployment (/usr/local/lib/node_modules/aws-cdk/lib/index.js:426:10236)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.deployStack2 [as deployStack] (/usr/local/lib/node_modules/aws-cdk/lib/index.js:429:153380)
    at async /usr/local/lib/node_modules/aws-cdk/lib/index.js:429:137002

The stack named xxxstack failed to deploy: UPDATE_ROLLBACK_COMPLETE: Received response status [FAILED] from custom resource. Message returned: ProxyAgent is not a constructor

Logs: xxxOnEventHandler42BEBAE0-jXvWcu93ZFF4

    at Object.<anonymous> (/var/task/index.js:1:417)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at _tryRequireFile (file:///var/runtime/index.mjs:912:37)
    at _tryRequire (file:///var/runtime/index.mjs:962:25)
    at _loadUserApp (file:///var/runtime/index.mjs:991:22) (RequestId: 09418d76-9c40-46da-9cfe-1d056ff8e2ad)

lambda logs from handler:

INIT_START Runtime Version: nodejs:18.v10	Runtime Version ARN: arn:aws:lambda:us-east-1::runtime:e3aaabf6b92ef8755eaae2f4bfdcb7eb8c4536a5e044900570a42bdba7b869d9

2023-08-16T15:42:53.629Z	undefined	ERROR	Uncaught Exception 	{
    "errorType": "TypeError",
    "errorMessage": "ProxyAgent is not a constructor",
    "stack": [
        "TypeError: ProxyAgent is not a constructor",
        "    at Object.<anonymous> (/var/task/index.js:1:417)",
        "    at Module._compile (node:internal/modules/cjs/loader:1256:14)",
        "    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)",
        "    at Module.load (node:internal/modules/cjs/loader:1119:32)",
        "    at Module._load (node:internal/modules/cjs/loader:960:12)",
        "    at Module.require (node:internal/modules/cjs/loader:1143:19)",
        "    at require (node:internal/modules/cjs/helpers:110:18)",
        "    at _tryRequireFile (file:///var/runtime/index.mjs:912:37)",
        "    at _tryRequire (file:///var/runtime/index.mjs:962:25)",
        "    at _loadUserApp (file:///var/runtime/index.mjs:991:22)"
    ]
}

Unknown application error occurred
Runtime.Unknown

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Aug 16, 2023
@peterwoodworth
Copy link
Contributor

Could you please share your CDK code which reproduces this?

@peterwoodworth peterwoodworth added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Aug 16, 2023
@MrArnoldPalmer
Copy link
Contributor

Pretty sure this was caused by #26722, reproduced with the eks cluster integ test. Just need to change to import to correctly use the 6.0 export. Working on a fix.

@peterwoodworth peterwoodworth added p0 and removed p2 labels Aug 16, 2023
MrArnoldPalmer added a commit that referenced this issue Aug 16, 2023
When we [upgraded the proxy-agent v6](#26722)
we did not update how we were importing from the package. Where
[in 5.0 commonjs exports were used](https://github.com/TooTallNate/node-proxy-agent/blob/5.0.0/index.js#L25)
, in [6.0 a named esm export is used](https://github.com/TooTallNate/proxy-agents/blob/proxy-agent%406.1.0/packages/proxy-agent/src/index.ts#L71).

Updated to use a named import statement instead of a default require.
Typescript also confirms the old import was an error now since we use
`import` instead of `require`.

Fixes: #26771
@mergify mergify bot closed this as completed in #26782 Aug 16, 2023
mergify bot pushed a commit that referenced this issue Aug 16, 2023
When we [upgraded the proxy-agent v6](#26722) we did not update how we were importing from the package. Where [in 5.0 commonjs exports were used](https://github.com/TooTallNate/node-proxy-agent/blob/5.0.0/index.js#L25) , in [6.0 a named esm export is used](https://github.com/TooTallNate/proxy-agents/blob/proxy-agent%406.1.0/packages/proxy-agent/src/index.ts#L71).

Updated to use a named import statement instead of a default require. Typescript also confirms the old import was an error now since we use `import` instead of `require`.

Fixes: #26771

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service bug This issue is a bug. p0 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants