Skip to content

Commit ea8d185

Browse files
Adding polish and temporary logging (#16424)
1 parent 8bd9aad commit ea8d185

File tree

5 files changed

+28
-4
lines changed

5 files changed

+28
-4
lines changed

docs-v2/components/AccountConnectionDemo.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default function AccountConnectionDemo() {
6363
)}
6464

6565
{connectedAccount && (
66-
<div className={styles.statusBox.success}>
66+
<div className={`${styles.statusBox.success} p-4`}>
6767
<div className="font-medium text-sm">Successfully connected your {appSlug} account!</div>
6868
<div className="mt-4 text-sm">
6969
{connectedAccount.loading

docs-v2/components/ConnectLinkDemo.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export default function ConnectLinkDemo() {
8282
rel="noopener noreferrer"
8383
className={`${styles.primaryButton} inline-flex items-center`}
8484
>
85-
Open Connect Link
85+
Open
8686
<svg xmlns="http://www.w3.org/2000/svg" className="h-4 w-4 ml-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
8787
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
8888
</svg>
@@ -94,7 +94,7 @@ export default function ConnectLinkDemo() {
9494
}}
9595
className={styles.secondaryButton}
9696
>
97-
Copy URL
97+
Copy
9898
<svg xmlns="http://www.w3.org/2000/svg" className="h-4 w-4 ml-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
9999
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3" />
100100
</svg>

docs-v2/components/api.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
/**
66
* Generate a request token based on the browser environment
77
* Creates a token that matches what the API will generate
8+
*
9+
* Note: Server-side uses the origin's hostname for token generation
10+
* to handle domain mapping in production environments
811
*/
912
export function generateRequestToken() {
1013
if (typeof window === "undefined") return "";
1114

15+
// Use the same origin's hostname that the server will use when generating the token
1216
const baseString = `${navigator.userAgent}:${window.location.host}:connect-demo`;
1317
return btoa(baseString);
1418
}

docs-v2/next.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,10 +554,18 @@ export default withNextra({
554554
source: "/api-demo-connect/token",
555555
destination: "/api/demo-connect/token",
556556
},
557+
{
558+
source: "/api-demo-connect/token/",
559+
destination: "/api/demo-connect/token",
560+
},
557561
{
558562
source: "/api-demo-connect/accounts/:id",
559563
destination: "/api/demo-connect/accounts/:id",
560564
},
565+
{
566+
source: "/api-demo-connect/accounts/:id/",
567+
destination: "/api/demo-connect/accounts/:id",
568+
},
561569
];
562570
},
563571
env: {

docs-v2/pages/api/demo-connect/accounts/[id].js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
* Retrieves information about connected accounts for the interactive demo
44
*/
55
import { createBackendClient } from "@pipedream/sdk/server";
6-
import { createApiHandler } from "../utils";
6+
import {
7+
createApiHandler, generateRequestToken,
8+
} from "../utils";
79

810
/**
911
* Handler for account details retrieval
@@ -17,6 +19,15 @@ async function accountHandler(req, res) {
1719
});
1820
}
1921

22+
// Debug logging for troubleshooting token validation
23+
console.log("Account API request:", {
24+
id,
25+
host: req.headers.host,
26+
origin: req.headers.origin,
27+
requestToken: req.headers["x-request-token"],
28+
expectedToken: generateRequestToken(req),
29+
});
30+
2031
try {
2132
// Initialize the Pipedream SDK client
2233
const pd = createBackendClient({
@@ -34,6 +45,7 @@ async function accountHandler(req, res) {
3445
// Return the account details
3546
return res.status(200).json(accountDetails);
3647
} catch (err) {
48+
console.error("Error fetching account details:", err.message);
3749
return res.status(500).json({
3850
error: "Failed to fetch account details",
3951
});

0 commit comments

Comments
 (0)