Skip to content

Commit

Permalink
Merge pull request #233 from axiomhq/arne/custom-endpoint-only-frontend
Browse files Browse the repository at this point in the history
fix: Only use the custom endpoint on frontend calls
  • Loading branch information
c-ehrlich authored Sep 6, 2024
2 parents db0f477 + 6be7c31 commit d0556c4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ node_modules/
dist/
.vscode/
coverage/
.envrc
.envrc
/.env
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "next-axiom",
"description": "Send WebVitals from your Next.js project to Axiom.",
"version": "1.5.0",
"version": "1.5.1",
"author": "Axiom, Inc.",
"license": "MIT",
"contributors": [
Expand Down
4 changes: 2 additions & 2 deletions src/platform/generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ export default class GenericConfig implements Provider {
}

getLogsEndpoint(): string {
if (this.customEndpoint) {
if (isBrowser && this.customEndpoint) {
return this.customEndpoint
}

return isBrowser ? `${this.proxyPath}/logs` : this.getIngestURL(EndpointType.logs);
}

getWebVitalsEndpoint(): string {
if (this.customEndpoint) {
if (isBrowser && this.customEndpoint) {
return this.customEndpoint
}

Expand Down
4 changes: 2 additions & 2 deletions src/platform/vercel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ export default class VercelConfig extends GenericConfig implements Provider {
}

getWebVitalsEndpoint(): string {
if (this.customEndpoint) {
if (isBrowser && this.customEndpoint) {
return this.customEndpoint
}

return `${this.proxyPath}/web-vitals`;
}

getLogsEndpoint(): string {
if (this.customEndpoint) {
if (isBrowser && this.customEndpoint) {
return this.customEndpoint
}

Expand Down

0 comments on commit d0556c4

Please sign in to comment.