Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix URL in getPublicOas Function to Correct API Spec Download Path @medusajs/medusa-oas-cli #8762

Closed
vholik opened this issue Aug 26, 2024 · 4 comments · Fixed by #8763
Closed

Comments

@vholik
Copy link

vholik commented Aug 26, 2024

Bug report

I encountered an issue after installing a fresh oas package using the following command:

yarn add --dev @medusajs/medusa-oas-cli@preview

Upon running generate command, I received the following error:

ResolverError: Error downloading https://docs.medusajs.com/v2/api/download/admin 
HTTP ERROR 404
    at /Users/vholik/Desktop/medusa-2-0/node_modules/@readme/json-schema-ref-parser/lib/resolvers/http.js:101:16
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERESOLVER',
  source: 'https://docs.medusajs.com/v2/api/download/admin',
  path: null,
  toJSON: [Function: toJSON],
  [Symbol(nodejs.util.inspect.custom)]: [Function: inspect]
}

Describe the bug

I was able to resolve the issue by modifying the getPublicOas URL in the package code.

async function getPublicOas(apiType) {
-    const url = `https://docs.medusajs.com/v2/api/download/${apiType}`;
+    const url = `https://docs.medusajs.com/api/download/${apiType}`;
    return await openapi_parser_1.default.parse(url);
}

System information

Medusa version (including plugins):
Node.js version:
Database:
Operating system:
Browser (if relevant):

Steps to reproduce the behavior

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen

Screenshots

If applicable, add screenshots to help explain your problem

Code snippets

If applicable, add code samples to help explain your problem

Additional context

Add any other context about the problem here

@shahednasser
Copy link
Member

Hello! Are you trying to generate OAS for v1 or v2? If for v1, please use the @latest version instead.

However, for v2, it seems the URL is definitely incorrect. It should be https://docs.medusajs.com/v2/api/api/download/${apiType}. Will open a PR to fix it.

@vholik
Copy link
Author

vholik commented Aug 26, 2024

Hello @shahednasser. I am using Medusa 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
@shahednasser @vholik and others