@efaj/pulumi-dynamic-stripe 0.0.2 → 0.1.0-252fa04
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/Makefile +12 -3
- package/README.md +38 -4
- package/biome.json +37 -0
- package/dist/StripePaymentLink.d.ts +15 -1
- package/dist/StripePaymentLink.js +41 -18
- package/dist/StripePrice.d.ts +44 -3
- package/dist/StripePrice.js +52 -6
- package/dist/StripeProduct.d.ts +2 -2
- package/dist/StripeProduct.js +10 -8
- package/dist/enums.d.ts +24 -0
- package/dist/enums.js +32 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/utils.d.ts +7 -0
- package/dist/utils.js +28 -0
- package/docs/troubleshooting-stuck-state.md +63 -0
- package/package.json +41 -37
- package/tests/index.test.ts +884 -315
- package/tests/integration.test.ts +46 -0
- package/vitest.config.ts +7 -0
- package/jest.config.js +0 -5
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Troubleshooting Stuck State in Pulumi Dynamic Providers
|
|
2
|
+
|
|
3
|
+
## The Problem
|
|
4
|
+
|
|
5
|
+
When using `pulumi-dynamic-stripe` versions **0.0.1** and **0.0.2**, you might encounter an issue where Pulumi fails to delete a Stripe resource (e.g., a Payment Link) during a `pulumi up`, `pulumi destroy`, or replacement operation.
|
|
6
|
+
|
|
7
|
+
The stack will show the resource as `deleting failed` with an error similar to this:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Error: Neither apiKey nor config.authenticator provided
|
|
11
|
+
at Stripe._setAuthenticator (node_modules/stripe/src/stripe.core.ts:1319:13)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Why This Happens
|
|
15
|
+
|
|
16
|
+
This is fundamentally caused by how Pulumi Dynamic Providers function under the hood.
|
|
17
|
+
|
|
18
|
+
When you deploy a resource using a Dynamic Provider, Pulumi takes the **JavaScript source code of your provider methods** (like `create`, `update`, `diff`, and importantly `delete`) and **serializes the compiled code directly into the Pulumi state file in the cloud**.
|
|
19
|
+
|
|
20
|
+
In versions `0.0.1` and `0.0.2` of this library, the `delete` method had a bug where it crashed if it couldn't find an API key in the Pulumi state (due to how state diffs and replacement work). Although we patched this bug in the library's source code by adding environment variable fallbacks and `try/catch` handlers, **Pulumi does not use your newly updated local code to delete older resources.**
|
|
21
|
+
|
|
22
|
+
Instead, Pulumi downloads the *old, buggy, serialized `delete` function* that was saved in the cloud during the resource's initial creation, and attempts to run it. When that old code inevitably crashes, the resource gets stuck in a perpetual `deleting failed` state.
|
|
23
|
+
|
|
24
|
+
## The Solution
|
|
25
|
+
|
|
26
|
+
Since you cannot fix an old resource's deletion behavior by updating your local provider package, you must manually excise the corrupted resource from the Pulumi state.
|
|
27
|
+
|
|
28
|
+
### Step 1: Export the Pulumi State
|
|
29
|
+
First, export your stack's state to a local JSON file:
|
|
30
|
+
```bash
|
|
31
|
+
pulumi stack export > state.json
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Step 2: Identify and Remove the Corrupted Resource
|
|
35
|
+
Open `state.json` in a text editor and search for the resource that is stuck. You are looking for a JSON object in the `deployment.resources` array that matches your resource's URN and has `"delete": true` set.
|
|
36
|
+
|
|
37
|
+
For example, look for something like this and **delete the entire JSON object from the array**:
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"urn": "urn:pulumi:prod.quiz.crenet-games::quizai-infrastructure::pulumi-nodejs:dynamic:Resource::sparks-link",
|
|
41
|
+
"custom": true,
|
|
42
|
+
"delete": true,
|
|
43
|
+
"id": "plink_1U8pkf1i5elBtkZIXxmnduNm",
|
|
44
|
+
"type": "pulumi-nodejs:dynamic:Resource",
|
|
45
|
+
"inputs": { ... }
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
*Alternatively, you can script this step using Node or `jq`.*
|
|
50
|
+
|
|
51
|
+
### Step 3: Import the Fixed State
|
|
52
|
+
Once the offending resource object is removed from the JSON array, save the file and import it back to Pulumi:
|
|
53
|
+
```bash
|
|
54
|
+
pulumi stack import --file state.json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Step 4: Re-run Pulumi Up
|
|
58
|
+
Now that the stuck state is gone, Pulumi will no longer attempt to run the broken deletion hook. Run your update command:
|
|
59
|
+
```bash
|
|
60
|
+
pulumi up -y
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Moving forward, any new resources created by the updated provider will have the new, robust, crash-free `delete` function serialized into the state, permanently solving this issue.
|
package/package.json
CHANGED
|
@@ -1,38 +1,42 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
2
|
+
"name": "@efaj/pulumi-dynamic-stripe",
|
|
3
|
+
"version": "0.1.0-252fa04",
|
|
4
|
+
"description": "A Pulumi Dynamic Provider for Stripe, supporting modern features like Payment Links.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pulumi",
|
|
7
|
+
"stripe"
|
|
8
|
+
],
|
|
9
|
+
"homepage": "https://github.com/efaj/pulumi-dynamic-stripe#readme",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/efaj/pulumi-dynamic-stripe/issues"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/efaj/pulumi-dynamic-stripe.git"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "Emmanuel Abarca Jimenez <efaj@crenet.games> (https://crenet.games/emmanuel)",
|
|
19
|
+
"type": "commonjs",
|
|
20
|
+
"main": "dist/index.js",
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc",
|
|
24
|
+
"prepare": "tsc",
|
|
25
|
+
"test": "vitest run tests/index.test.ts",
|
|
26
|
+
"test:integration": "vitest run tests/integration.test.ts",
|
|
27
|
+
"lint": "biome check .",
|
|
28
|
+
"lint:fix": "biome check --write .",
|
|
29
|
+
"format": "biome format --write ."
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@pulumi/pulumi": "^3.259.0",
|
|
33
|
+
"stripe": "^22.6.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@biomejs/biome": "2.5.11",
|
|
37
|
+
"@types/node": "^26.4.0",
|
|
38
|
+
"typescript": "^6.0.3",
|
|
39
|
+
"vite": "^6.4.3",
|
|
40
|
+
"vitest": "^3.2.7"
|
|
41
|
+
}
|
|
42
|
+
}
|