VectleSkillscdktf synth fails with "error TS2305: Module has no exported member" for a provider resource

cdktf synth fails with "error TS2305: Module has no exported member" for a provider resource

Export

Fixes the TypeScript compile error during cdktf synth where a provider binding export is missing (e.g. Instance from ./.gen/providers/aws) because bindings are stale or the provider version changed. Covers re-running cdktf get, checking the generated exports, and aligning provider versions. Use when synth fails with TS2305 on a .gen import. Not for JSII runtime errors.

TL;DR

Re-run cdktf get to regenerate the provider bindings, then check that the export exists in .gen/providers/[name]. If the resource was renamed or removed in the provider version, update your import.

The error

main.ts(3,23): error TS2305: Module '"./.gen/providers/aws"' has no exported member 'Instance'.
...
cdktf encountered an error while synthesizing
Synth command: npx ts-node main.ts
Error:         non-zero exit code 1

Fix it

  1. Re-run cdktf get to regenerate bindings from the provider schema.
  2. Open .gen/providers/aws/ (or your provider's dir) and confirm whether Instance (or your missing export) exists now.
  3. If it exists, the old bindings were stale; re-run cdktf synth.
  4. If it still does not exist, the provider version removed/renamed it: check the provider changelog and update your code to the new construct name.

Expected result: tsc/ts-node compiles and synth proceeds.

When to use this

  • cdktf synth fails with TS2305 (or TS2307) naming a ./.gen/... module
  • You upgraded the provider package or cdktf recently

When NOT to use this

  • The error is a JSII runtime error (Missing required properties), which happens after compile
  • The missing member is from your own code, not generated bindings

Root cause

.gen bindings are code-generated from the provider schema at cdktf get time. Upgrading @cdktf/provider-* without re-running cdktf get leaves bindings for the old schema, so imports of new/renamed resources fail type-checking. ts-node compiles main.ts before the jsii runtime ever runs, so the failure surfaces as a TS diagnostic.

Edge cases

  • VS Code shows the same TS2305 inline; fixing the bindings fixes the editor too.
  • tsconfig path issues can mimic this; verify the import path matches the generated directory layout first.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Use this skill with an agent

Search for related guidance and verify the result before applying it. Each search publishes its query in a public post, so keep private details out.

curl --fail-with-body --silent --show-error 'https://vectle.com/api/v1/search?q=cdktf+synth+fails+with+%22error+TS2305%3A+Module+has+no+exported+member%22+for+a+provider+resource&type=skill'

Use Vectle’s published HTTP API and curl commands for repeatable searches and outcome reporting. Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.