blimmer / cdk-datadog-integration

Amazon Cloud Development Kit (CDK) logic to integrate your AWS account with Datadog
Apache License 2.0
19 stars 8 forks source link

Python version throw an error #15

Closed thomaspoignant closed 2 years ago

thomaspoignant commented 4 years ago

Hi,

I am trying to use the python version of the library and when I run cdk synth I got the stack bellow. I don't know that much how JSII works but the problem seems related to source-map-support/register.

jsii.errors.JavaScriptError:
  internal/modules/cjs/loader.js:1033
    throw err;
    ^

  Error: Cannot find module 'source-map-support/register'
  Require stack:
  - /private/var/folders/_j/vkq9ggqd44d0mdfzk5rrfsg1_7f_x5/T/jsii-kernel-R60LIH/node_modules/cdk-datadog-integration/lib/index.js
  - 49
      at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1030:15)
      at Function.Module._load (internal/modules/cjs/loader.js:899:27)
      at Module.require (internal/modules/cjs/loader.js:1090:19)
      at require (internal/modules/cjs/helpers.js:75:18)
      at Object.<anonymous> (/private/var/folders/_j/vkq9ggqd44d0mdfzk5rrfsg1_7f_x5/T/jsii-kernel-R60LIH/node_modules/cdk-datadog-integration/lib/index.js:3:1)
      at Module._compile (internal/modules/cjs/loader.js:1201:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
      at Module.load (internal/modules/cjs/loader.js:1050:32)
      at Module._load (internal/modules/cjs/loader.js:938:14)
      at Kernel._execute (/Users/thomas.poignant/Documents/dev/search-infra/.env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:8417:19)
      at Kernel.load (/Users/thomas.poignant/Documents/dev/search-infra/.env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7657:30)
      at KernelHost.processRequest (/Users/thomas.poignant/Documents/dev/search-infra/.env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7446:28)
      at KernelHost.run (/Users/thomas.poignant/Documents/dev/search-infra/.env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7384:14)
      at Immediate._onImmediate (/Users/thomas.poignant/Documents/dev/search-infra/.env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7387:37)
      at processImmediate (internal/timers.js:458:21)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "app.py", line 4, in <module>
    from search_infra.search_stack import SearchInfraStack
  File "/Users/thomas.poignant/Documents/dev/search-infra/search_infra/search_stack.py", line 10, in <module>
    from datadog import Datadog
  File "/Users/thomas.poignant/Documents/dev/search-infra/search_infra/datadog.py", line 5, in <module>
    from cdk_datadog_integration import DatadogIntegrationStack
  File "/Users/thomas.poignant/Documents/dev/search-infra/.env/lib/python3.8/site-packages/cdk_datadog_integration/__init__.py", line 65, in <module>
    from ._jsii import *
  File "/Users/thomas.poignant/Documents/dev/search-infra/.env/lib/python3.8/site-packages/cdk_datadog_integration/_jsii/__init__.py", line 16, in <module>
    __jsii_assembly__ = jsii.JSIIAssembly.load("cdk-datadog-integration", "1.0.1", __name__[0:-6], "cdk-datadog-integration@1.0.1.jsii.tgz")
  File "/Users/thomas.poignant/Documents/dev/search-infra/.env/lib/python3.8/site-packages/jsii/_runtime.py", line 40, in load
    _kernel.load(assembly.name, assembly.version, os.fspath(assembly_path))
  File "/Users/thomas.poignant/Documents/dev/search-infra/.env/lib/python3.8/site-packages/jsii/_kernel/__init__.py", line 215, in load
    self.provider.load(LoadRequest(name=name, version=version, tarball=tarball))
  File "/Users/thomas.poignant/Documents/dev/search-infra/.env/lib/python3.8/site-packages/jsii/_kernel/providers/process.py", line 330, in load
    return self._process.send(request, LoadResponse)
  File "/Users/thomas.poignant/Documents/dev/search-infra/.env/lib/python3.8/site-packages/jsii/_kernel/providers/process.py", line 318, in send
    raise JSIIError(resp.error) from JavaScriptError(resp.stack)
jsii.errors.JSIIError: Cannot find module 'source-map-support/register'
Require stack:
- /private/var/folders/_j/vkq9ggqd44d0mdfzk5rrfsg1_7f_x5/T/jsii-kernel-R60LIH/node_modules/cdk-datadog-integration/lib/index.js
- 49
blimmer commented 4 years ago

Hey @thomaspoignant - I'm sorry to hear you're having problems with the library. I primarily use cdk on Node, so I haven't experienced this. I just generated a Python test project and ran into the same error you're experiencing.

I'll need to find some time to debug this problem. In the meantime, if you need this behavior, you could take a look at the source code and translate it over to Python or use the Node version of the library that should work.

Thanks for the report and sorry it didn't work out of the box.

thomaspoignant commented 4 years ago

In the meantime, if you need this behavior, you could take a look at the source code and translate it over to Python

That's what I did, but I wanted to open this issue to let you know 👍

blimmer commented 4 years ago

Awesome! I'm glad to hear that you're unblocked and I appreciate you letting me know 😄

blimmer commented 2 years ago

This should be fixed in v1.3.2 and beyond. Thank you for your report!

thomaspoignant commented 2 years ago

Awesome thank you 👍