[Integration API] GET /site-resource/{siteResourceId} not working
- Dominant language
- TypeScript
- Stars
- 22.8k
- Forks
- 783
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 52
Description
### Describe the Bug
As said in the title this route in the integration API is not working.
Here is the error I get with a 400 status :
`'Validation error: Invalid input: expected string, received undefined at "siteId"; Invalid input: expected string, received undefined at "orgId"'`
After taking a quick look at the code (even tho I have not done any ts and zod for a looooong time), I believe this bug is due to [the zod schema](https://github.com/fosrl/pangolin/blob/main/server/routers/siteResource/getSiteResource.ts#L13) expecting a siteId and an orgId but [the route](https://github.com/fosrl/pangolin/blob/main/server/routers/external.ts#L312) does not contains it.
So either the getSiteResource function should be working without it either the route needs to be updated with the correct path params.
### Environment
I have been able to reproduce this bug in :
* free tier pangolin.net hosted
* self hosted v1.15.3 on NixOS
### To Reproduce
Just create a site-resource, get its id via `/org/{orgId}/site-resources` and then try to get it via `/site-resource/{siteResourceId}`. I think this issue is very old because it is happening on my selfhosted v1.15.3 AND on the app.pangolin.net hosted free tier.
### Expected Behavior
Should return me a site-resource.
Contributor guide
Research direction
Start with server/routers/external.ts around the GET /site-resource/{siteResourceId} route and server/routers/siteResource/getSiteResource.ts around the referenced schema. Reproduce the request after creating a site resource, then compare the route parameters with the schema inputs. Done means the endpoint returns the requested site resource instead of the siteId and orgId validation error, with coverage for the corrected request path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100