Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions create-db-worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export default {
region?: string;
name?: string;
analytics?: { eventName?: string; properties?: Record<string, unknown> };
userAgent?: string;
};

let body: CreateDbBody = {};
Expand All @@ -104,16 +105,17 @@ export default {
return new Response('Invalid JSON body', { status: 400 });
}

const { region, name, analytics: analyticsData } = body;
const { region, name, analytics: analyticsData, userAgent } = body;
if (!region || !name) {
return new Response('Missing region or name in request body', { status: 400 });
}

console.log('userAgent:', userAgent);
const prismaResponse = await fetch('https://api.prisma.io/v1/projects', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${env.INTEGRATION_TOKEN}`,
'User-Agent': userAgent || '',
},
body: JSON.stringify({
region,
Expand Down
3 changes: 2 additions & 1 deletion create-db/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,8 @@ async function createDatabase(name, region, userAgent, silent = false) {
body: JSON.stringify({
region,
name,
utm_source: userAgent || CLI_NAME,
utm_source: CLI_NAME,
userAgent,
}),
});

Expand Down