question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(synthetics): add Runtime property for syn-python-selenium-1.0 to create synthetics canary

See original GitHub issue

I want to use CDK to create synthetic canary in python and selenium. However, when I try to write some code, i found the there is no matching runtime property.

Not found syn-python-selenium-1.0 from the API docs: - https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_synthetics/Runtime.html - https://docs.aws.amazon.com/cdk/api/latest/typescript/api/aws-synthetics/runtime.html#aws_synthetics_Runtime

Is there anyway I can create this type canary by CDK?

Use Case

    const canary = new synthetics.Canary(this, 'MyCanary', {
      schedule: synthetics.Schedule.rate(Duration.minutes(5)),
      test: Test.custom({
        // code: synthetics.Code.fromAsset(path.join(__dirname, 'lambda')),
        code: synthetics.Code.fromInline(
          fs
            .readFileSync(path.join(__dirname, '../../lambda/app.py'))
            .toString()
        ),
        handler: 'index.handler',
      }),
      runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_1,
    });

The synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_1 in above code is for NodeJS and Puppeteer

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kaizencccommented, Aug 12, 2021

While the workaround works for code that’s fromInline() or fromBucket(), there is currently a requirement for code fromAsset() to have the file structure nodejs/node_modules. The relevant line of code is here and this issue was referenced previously.

It looks like in addition to adding the static method we need to also modify the validateCanaryAsset check to parse between node runtimes and python runtimes. We should be checking that canaries with python runtimes come from within a python folder [source].

1reaction
BenChaimbergcommented, Jun 17, 2021

Sorry, should have specified the workaround: new Runtime('syn-python-selenium-1.0'). But should keep this open to support this via a static method.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Synthetics runtime versions - Amazon CloudWatch
Explains the versions of CloudWatch Synthetics runtimes, libraries, ... When you create or update a canary, you choose a Synthetics runtime version for...
Read more >
Create Canaries Using Amazon CloudWatch Synthetics
In this video, you'll see how to create canaries using Amazon CloudWatch Synthetics. With this feature, you can create different kinds of ...
Read more >
CloudWatch Synthetics: Tutorial by Example - OpsRamp
Learn how to use CloudWatch Synthetics canaries to check API endpoints and broken links, and understand how to integrate the service with AWS...
Read more >
aws_synthetics_canary | Resources | hashicorp/aws
When you create a canary, AWS creates supporting implicit resources. See the Amazon CloudWatch Synthetics documentation on DeleteCanary for a full list.
Read more >
@aws-cdk/aws-synthetics - npm
The Canary code will be executed in a lambda function created by Synthetics on your behalf. The Lambda function includes a custom runtime...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found