Alec Handal
11/03/2025, 5:26 PMminduo@0.1.0 permit:bootstrap /Users/alechandal/Repos/minduo
tsx scripts/permit/bootstrap-resources.ts -- --env dev{"level":50,"time":"2025-11-03T172247.414Z","label":"permit-bootstrap","msg":"Got error status code: 500, err:{\"id\":\"30f50c095157412cb3370c9bb5656428\",\"title\":\"The request could not be completed\",\"error_code\":\"UNEXPECTED_ERROR\",\"message\":\"You did nothing wrong, but we could not finish your request due to a technical issue on our end. Please try again.\\nIf the issue keeps happening, contact our support.\"}"} Failed to bootstrap Permit resources PermitApiError: You did nothing wrong, but we could not finish your request due to a technical issue on our end. Please try again. If the issue keeps happening, contact our support for further guidance. at ResourcesApi2.handleApiError (...) at ResourcesApi2.replace (...) at async main (.../scripts/permit/bootstrap-resources.ts2525) { originalError: AxiosError: Request failed with status code 500 at settle (...) at IncomingMessage.handleStreamEnd (...) at process.processTicksAndRejections (...) at Axios.request (...) at async ResourcesApi2.replace (...) at async main (.../scripts/permit/bootstrap-resources.ts2525) { code: 'ERR_BAD_RESPONSE', config: { baseURL: 'http://localhost:7766/', method: 'put', data: '{"name":"Organization","actions":{"create":{},"invite":{},"deprovision":{}},"attributes":{"orgId":{"type":"string","description":"Primary key from Minduo database"}}}', url: 'https://api.permit.io/v2/schema/<project-id>/<env-id>/resources/organization', headers: { Accept: 'application/json, text/plain, */*', 'Content-Type': 'application/json', 'X-Permit-SDK-Version': 'node:0.1.0', Authorization: 'Bearer <REDACTED>', 'User-Agent': 'axios/1.13.1', 'Content-Length': 166, 'Accept-Encoding': 'gzip, compress, deflate, br', Host: 'api.permit.io', Connection: 'keep-alive' }, // remaining axios metadata omitted for brevity }, response: { status: 500, statusText: 'Internal Server Error', headers: { /* redacted */ }, data: { /* redacted */ } }, status: 500 } }
Ask Inkeep
11/03/2025, 5:26 PMAsk Inkeep
11/03/2025, 5:26 PMreplace method (1) to bootstrap resources.
The issue appears to be a configuration mismatch - your axios config shows baseURL: '<http://localhost:7766/>' (which would be a local PDP) , but the actual request is going to '<https://api.permit.io/v2/schema/<project-id>/<env-id>/resources/organization>' . This suggests there might be a conflict in your configuration.
Based on the Node.js SDK implementation , the replace method:
public async replace(resourceKey: string, resourceData: ResourceReplace) : Promise<ResourceRead> {
await this.ensureAccessLevel(ApiKeyLevel.ENVIRONMENT_LEVEL_API_KEY) ;
await this.ensureContext(ApiContextLevel.ENVIRONMENT) ;
try {
return (
await this.resources.replaceResource({
...this.config.apiContext.environmentContext,
resourceId: resourceKey,
resourceReplace: resourceData,
})
) .data;
} catch (err) {
this.handleApiError(err) ;
}
}
To help our engineers investigate this issue further, could you please provide:
1. Which Workspace / Project / Env you are using (looks like you have <project-id>/<env-id> in the URL)
2. The exact SDK calls you're performing (your bootstrap script code)
3. Which PDP version you are running (if using a local PDP at localhost:7766)
4. Any relevant logs from your PDP if you're running one locally
This will help identify whether it's a configuration issue or a server-side problem.Ask Inkeep
11/03/2025, 5:26 PMAlec Handal
11/03/2025, 5:36 PMconst permit = new Permit({
token: requireEnv("PERMIT_API_KEY"),
environment: targetEnv, // defaults to dev
pdp: process.env.PERMIT_PDP_URL, // <http://localhost:7766> when the PDP is running
apiUrl: process.env.PERMIT_API_URL, // unset → defaults to Permit cloud API
log: {
level: process.env.NODE_ENV === "production" ? "warn" : "info",
label: "permit-bootstrap",
json: false,
},
});
for (const resource of resources) {
const payload = {
name: resource.name,
description: resource.description,
actions: toActionMap(resource.actions), // e.g. { create: {}, invite: {}, ... }
attributes: toAttributeMap(resource.attributes),
relations: resource.relations,
};
await permit.api.resources.replace(resource.key, payload);
console.log(`Synced resource schema: ${resource.key}`);
}
The failing call is permit.api.resources.replace("organization", { ... }), which expands to a PUT on https://api.permit.io/v2/schema/<project-id>/<env-id>/resources/organization. The payload for that first call is:
{
"name": "Organization",
"actions": {
"create": {},
"invite": {},
"deprovision": {}
},
"attributes": {
"orgId": {
"type": "string",
"description": "Primary key from Minduo database"
}
}
}
3. PDP version
• Container image: permitio/pdp-v2:latest
• Exposed at http://localhost:7766
4. Recent PDP logs
2025-11-03T17:24:42Z | uvicorn.protocols.http.httptools_impl | INFO | 127.0.0.1:37356 - "GET /healthy HTTP/1.1" 200
2025-11-03T17:24:47Z | uvicorn.protocols.http.httptools_impl | INFO | 127.0.0.1:37356 - "GET /healthy HTTP/1.1" 200
… (repeated /healthy probes every ~5s)
2025-11-03T17:29:22Z | uvicorn.protocols.http.httptools_impl | INFO | 127.0.0.1:37082 - "GET /healthy HTTP/1.1" 200
No error output from the PDP; it just responds to the health checks.Alon Boshi
11/03/2025, 5:41 PMThomas
11/03/2025, 11:09 PMAlec Handal
11/03/2025, 11:29 PMAlon Boshi
11/04/2025, 12:13 PM"actions": {
"create": {},
"deprovision": {},
"invite": {}
}
To:
"actions": {
"create": { "name": "create" },
"deprovision": { "name": "deprovision" },
"invite": { "name": "invite" }
}
This should resolve the problem.
Please let us know if it works on your end.Alec Handal
11/04/2025, 4:17 PM