Skip to content

Commit

Permalink
Removed AJV for Vercel
Browse files Browse the repository at this point in the history
  • Loading branch information
SellersEvan committed Apr 2, 2024
1 parent 46de5af commit b52e319
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and create event tracking endpoints for
[SherpaJS](https://github.com/sellersindustry/SherpaJS) an agnostic and modular
serverless platform.

> [!CAUTION]
> Vercel doesn't support AJV regularly, we are working on a fix, but as of now,
> validation doesn't work on Vercel.
<br>

Expand Down
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ import { Event, Payload, IService } from "./model";


export async function SendEvent(service:IService, event:Event, data:Payload):Promise<string|null> {
let validate = getSchema(event);
if (validate != undefined && !validate(data)) {
return getErrors(validate);
if (process.env.VERCEL == undefined) { //! FIXME
let validate = getSchema(event);
if (validate != undefined && !validate(data)) {
return getErrors(validate);
}
}
await service.add(event.id, data);
return null;
Expand Down

0 comments on commit b52e319

Please sign in to comment.