GithubHelp home page GithubHelp logo

Comments (14)

gr2m avatar gr2m commented on June 1, 2024 7

Post Mortem: "Property 'GET /user/:migration_id/repositories' does not exist on type 'Endpoints'" TypeScript error

Summary

Starting July 22, 4:20pm PDT, TypeScript users of the latest @octokit/rest version (18.x) started to see the following errors when compiling their code:

Property 'GET /user/:migration_id/repositories' does not exist on type 'Endpoints'

The error originated from two @octokit/rest dependencies.

  1. @octokit/plugin-rest-endpoint-methods
  2. @octokit/plugin-paginate-rest

The problem was originally reported by the TypeScript team on July 22, 7:16pm PDT (issue). The problem was resolved via @octokit/[email protected] and @octokit/[email protected], confirmed on Jul 23, 11:01am PDT (comment)

What happened

The source of the problem was a GitHub REST API path correction, which was published in the @github/openapi package version 5.0.2 on July 22, 12:02pm PDT.

Sever @octokit/* libraries receive automated pull request whenever a new version of the @github/openapi package is released. One such pull request updated @octokit/types in octokit/types.ts#137, which changed the /user/{migration_id}/repositories path to /user/migrations/{migration_id}/repositories. Once merged, the new version 5.1.1 was published to npm. We do not consider typescript changes to be breaking changes, as they do not impact code run in production, only at build time during local development or CI/CD.

Another pull request was for @octokit/plugin-rest-endpoints octokit/plugin-rest-endpoint-methods.js#171, in which the @octokit/types dependency was updated besides the path updates, in order to keep the two in sync.

The problem is that while @octokit/rest has a pinned dependency on @octokit/plugin-rest-endpoints, octokit/plugin-rest-endpoints does not have a pinned dependency on @ocotkit/types (in order to allow npm to de-duplicate it as it's required by many @octokit/* packages). That's how @octokit/plugin-rest-endpoints and @ocotkit/types became out of sync in the dependency tree of @octokit/rest.

The problem with the @octokit/plugin-rest-endpoints dependency was resolved via octokit/rest.js#1811 and a new version was released: @octokit/[email protected].

On top of that, the automated update of @octokit/plugin-paginate-rest triggered by the new @github/openapi release failed silently: https://github.com/octokit/plugin-paginate-rest.js/runs/899898279?check_suite_focus=true#step:6:14. @octokit/plugin-paginate-rest uses @octokit/types for internal type definitions, too. That is how @octokit/plugin-paginate-rest and @octokit/types became out of sync. The problem was resolved via octokit/plugin-paginate-rest.js#110 and a new version was released: @octokit/[email protected].

With @octokit/[email protected] and @octokit/[email protected], the "Property 'GET /user/:migration_id/repositories' does not exist on type 'Endpoints'" TypeScript error no longer occurs.

How we will prevent the problem from occurring again

In future, we will consider the removal or change of a type definition in @octokit/types to be a breaking change. While we won't consider TypeScript changes to be breaking changes overall, as they do not impact code run in production, this incident showed that due to dependency on @ocotkit/types across many @octokit/* packages the risk of out-of-sync packages is too high.

Had we published @octokit/[email protected] as @octokit/[email protected] instead, none of the problems had occurred. The worst impact would be that different versions might have existed in the @ocotkit/rest dependency tree for a short amount of time.

As we will be more strict with breaking changes on @octokit/types moving forward, we will also invest time to avoid breaking changes in the first place, by implementing deprecations, as we do in our JavaScript packages such as @octokit/rest and @octokit/plugin-rest-endpoint-methods. Breaking changes will only occur to remove previously deprecated APIs.

The other problem this incident surfaced was the silent error at https://github.com/octokit/plugin-paginate-rest.js/runs/899898279?check_suite_focus=true#step:6:14. We will make sure that the GitHub OpenAPI update builds will fail in future, which will trigger a notification.


Please comment below if you have any further questions.

from plugin-rest-endpoint-methods.js.

gr2m avatar gr2m commented on June 1, 2024 3

The problem should be fixed now. You need to update to latest @octokit/rest (18.0.2) and also make sure that to have the latest @octokit/plugin-paginate-rest sub dependency (2.2.4)

➜  TypeScript git:(master) ✗ npm ls @octokit/plugin-paginate-rest
[email protected] /private/var/folders/hs/x9qtfmvn1lz1sgml9q21h7k80000gn/T/tmp.5Ggh7uap/TypeScript
└─┬ @octokit/[email protected]
  └── @octokit/[email protected] 

Can you verify?

I'll write up a post-mortem to explain what happened, how I'll make sure it won't happen again.

from plugin-rest-endpoint-methods.js.

gr2m avatar gr2m commented on June 1, 2024 2

Odd, can you make sure if you have the latest version of @octokit/types in your dependency tree?

from plugin-rest-endpoint-methods.js.

gr2m avatar gr2m commented on June 1, 2024 2

I was able to reproduce the problem. I think I know what happened, please give me a moment to verify.

from plugin-rest-endpoint-methods.js.

gr2m avatar gr2m commented on June 1, 2024 2

Thank you for confirming!

from plugin-rest-endpoint-methods.js.

lukehedger avatar lukehedger commented on June 1, 2024 1

I am seeing this same error with the following versions:

"devDependencies": {
  "@octokit/types": "5.1.1",
  "typescript": "3.9.7"
},
"dependencies": {
  "@octokit/rest": "18.0.1"
}

Error log:

$ tsc
../node_modules/@octokit/plugin-paginate-rest/dist-types/generated/paginating-endpoints.d.ts:987:31 - error TS2339: Property 'GET /user/:migration_id/repositories' does not exist on type 'Endpoints'.

987         parameters: Endpoints["GET /user/:migration_id/repositories"]["parameters"];
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../node_modules/@octokit/plugin-paginate-rest/dist-types/generated/paginating-endpoints.d.ts:988:29 - error TS2339: Property 'GET /user/:migration_id/repositories' does not exist on type 'Endpoints'.

988         response: Endpoints["GET /user/:migration_id/repositories"]["response"];
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:961:60 - error TS2339: Property 'GET /user/:migration_id/repositories' does not exist on type 'Endpoints'.

961             parameters: RequestParameters & Omit<Endpoints["GET /user/:migration_id/repositories"]["parameters"], "baseUrl" | "headers" | "mediaType">;
                                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:962:33 - error TS2339: Property 'GET /user/:migration_id/repositories' does not exist on type 'Endpoints'.

962             response: Endpoints["GET /user/:migration_id/repositories"]["response"];
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 4 errors.

from plugin-rest-endpoint-methods.js.

nonara avatar nonara commented on June 1, 2024 1

@gr2m To clarify, I'm not talking about tsc failing for a project that I've written which uses the plugin. I'm referring to the source for the TypeScript compiler, itself, which has broad impact.

All versions above 3.8 are failing to build: microsoft/TypeScript#39712

This includes old releases which haven't been updated up to the latest. This seems to have happened as of a recent update for this plugin. (Not sure how long it's been happening. I discovered it yesterday)

Steps to reproduce can be found in the issue above.

from plugin-rest-endpoint-methods.js.

sparksp avatar sparksp commented on June 1, 2024

Odd, can you make sure if you have the latest version of @octokit/types in your dependency tree?

For me, I can see three major versions of @octokit/types in the lockfile (2, 4 and 5). @octokit/rest@^16.43.1 wants @octokit/plugin-rest-endpoint-methods=2.4.0 which in turn wants @octokit/types^2.0.1. If I add @octokit/types to my dependencies then everything is happy again.

Edit: In fact I had the @octokit/types^4.0.1 in my dependencies already - that'll be what did it for me. Many major version bumps recently!

from plugin-rest-endpoint-methods.js.

gr2m avatar gr2m commented on June 1, 2024

oh my, I'm looking into it

from plugin-rest-endpoint-methods.js.

jamesrenaud avatar jamesrenaud commented on June 1, 2024

I was having the identical issue to @nonara . Updated to @octokit/[email protected] and builds are completing.

"devDependencies": {
  "@octokit/types": "5.1.1",
  "typescript": "3.9.7"
},
"dependencies": {
  "@octokit/rest": "18.0.2"
}

from plugin-rest-endpoint-methods.js.

nonara avatar nonara commented on June 1, 2024

Thanks for the fast turnaround, @gr2m! Confirming now...

from plugin-rest-endpoint-methods.js.

nonara avatar nonara commented on June 1, 2024

Fresh clone compiles! 🎉

from plugin-rest-endpoint-methods.js.

orta avatar orta commented on June 1, 2024

thanks folks

from plugin-rest-endpoint-methods.js.

kaaloo avatar kaaloo commented on June 1, 2024

Awesome work! 👍

from plugin-rest-endpoint-methods.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.