Skip to content

Fix/issues 243 244 245 246 - #389

Merged
Mystery-CLI merged 5 commits into
Ethereal-Future:mainfrom
Lex-Studios:fix/issues-243-244-245-246
Apr 24, 2026
Merged

Fix/issues 243 244 245 246#389
Mystery-CLI merged 5 commits into
Ethereal-Future:mainfrom
Lex-Studios:fix/issues-243-244-245-246

Conversation

@Lex-Studios

Copy link
Copy Markdown
Contributor

Summary

This PR addresses four critical issues in the Stellar Wave backend, focusing on configuration compatibility, error handling, performance optimization, and network-aware asset
management.

Changes Implemented

Issue #243: TypeScript Configuration in ESM Project

File: backend/prisma.config.tsbackend/prisma.config.js

Converted Prisma configuration from TypeScript to ESM JavaScript. The project uses "type": "module" without a TypeScript toolchain, making Prisma CLI unable to read .ts config
files. The new prisma.config.js uses standard ESM syntax and is compatible with the project's module setup.

Impact: Prisma CLI now works correctly without requiring tsx or ts-node as dev dependencies.


Issue #244: CORS Error Handling Returns 500 Instead of 403

File: backend/src/server.js

Fixed CORS origin validation callback to properly return 403 Forbidden for disallowed origins instead of 500 Internal Server Error.

Changes:

  • Changed from cb(new Error(...)) which Express-CORS converts to 500
  • Now uses cb(null, false) with a dedicated CORS error handler middleware
  • Returns proper 403 status with clear error message: { error: 'CORS: origin not allowed' }

Impact: Clients receive correct HTTP status codes and clearer error messages for CORS violations.


Issue #245: Stream Analytics Loads All Records Into Memory

File: backend/src/services/streaming.js

Optimized getStreamAnalytics() function to use database-level aggregation instead of loading all payment stream records into application memory.

Changes:

  • Replaced findMany() with groupBy() to count streams by status
  • Added aggregate() query to compute total volume in database
  • Reduced distinct asset lookup to only select necessary fields
  • Parallel execution of three optimized queries

Impact: Significantly reduced memory usage and improved query performance, especially with large datasets. Database handles aggregation instead of application layer.


Issue #246: MultiSig Uses Direct Environment Variable for Asset Issuer

File: backend/src/services/multiSig.js

Replaced hardcoded process.env.ASSET_ISSUER with getIssuer(assetCode) function for proper per-network asset issuer lookup.

Changes:

  • Imported getIssuer from config/assets.js
  • Updated buildMultiSigTransaction() to use getIssuer(assetCode) instead of direct env var
  • Ensures correct issuer is used based on network (testnet/mainnet)

Impact: Multi-signature transactions now use correct asset issuers per network, preventing transactions from failing on testnet due to wrong issuer configuration.


Testing Recommendations

  • Verify Prisma CLI commands work: npx prisma migrate status
  • Test CORS with disallowed origin and verify 403 response
  • Monitor getStreamAnalytics() performance with large datasets
  • Test multi-sig transactions on both testnet and mainnet

Closes

Closes #243
Closes #244
Closes #245
Closes #246

@drips-wave

drips-wave Bot commented Apr 24, 2026

Copy link
Copy Markdown

@Lex-Studios Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Mystery-CLI
Mystery-CLI merged commit f410635 into Ethereal-Future:main Apr 24, 2026
8 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants