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

Issue Downgrading from Crawlee 3.7.2 to 3.4.0 - Persistent Version and TypeScript Errors #2279

Closed
1 task
wojtekKrol opened this issue Jan 11, 2024 · 8 comments
Labels
bug Something isn't working.

Comments

@wojtekKrol
Copy link

wojtekKrol commented Jan 11, 2024

Which package is this bug report for? If unsure which one to select, leave blank

@crawlee/http (HttpCrawler)

Issue description

Description

I recently updated Crawlee to version 3.7.2 in my project's package.json and encountered a TypeScript error during the build process. To resolve this, I attempted to downgrade back to version 3.4.0. However, despite modifying package.json and trying various methods to reset the environment, Crawlee remains at version 3.7.2, and the TypeScript error persists.

Steps to Reproduce

  1. Upgrade Crawlee in package.json to 3.7.2 and run npm install.
  2. Run build process; encounter TypeScript error (details below).
  3. Attempt to downgrade to Crawlee 3.4.0 by changing package.json.
  4. Remove package-lock.json and node_modules, then run npm install or npm ci. Crawlee stays at 3.7.2.
  5. Execute additional steps like clearing npm cache (npm cache clean --force), trying intermediate versions (3.5.0, 3.6.0), but issue persists.

Expected Behavior

After changing the version in package.json and clearing the node environment (removing node_modules, package-lock.json, clearing cache), Crawlee should downgrade to the specified version (3.4.0 in this case).

Actual Behavior

Crawlee remains at version 3.7.2 after downgrading attempts. TypeScript error encountered during build:

node_modules/@crawlee/http/internals/http-crawler.d.ts:372:44 - error TS1005: 'assert' expected.
372         request?: import("got-scraping", { with: { "resolution-mode": "import" } }).RequestFunction | undefined;
...
...
...
node_modules/@crawlee/http/internals/http-crawler.d.ts:469:5 - error TS1128: Declaration or statement expected.

469     private _requestAsBrowser;
        ~~~~~~~

node_modules/@crawlee/http/internals/http-crawler.d.ts:470:1 - error TS1128: Declaration or statement expected.

470 }
    ~


Found 140 errors in the same file, starting at: node_modules/@crawlee/http/internals/http-crawler.d.ts:372

The only version that I was able to downgrade are:

  • 3.7.0 - same error like in 3.7.2 case
  • 3.6.1 - other error still unable to build

This is command im using to build:
"build": "tsc --project tsconfig.build.json && tsc-alias --project tsconfig.build.json && echo 'Build complete'"

my package.json version:

"crawlee": "3.4.0", event thought in node_modules/@crawlee/http/package.json version points to 3.7.2 (in case of 3.7.0, 3.6.1 it points to correct version but there is still error when building the project)

Code sample

There is no code sample for this problem

Package version

3.4.0

Node.js version

18

Operating system

all of them

Apify platform

  • Tick me if you encountered this issue on the Apify platform

I have tested this on the next release

3.4.0, 3.4.1, 3.5.0 etc.

Other context

No response

@wojtekKrol wojtekKrol added the bug Something isn't working. label Jan 11, 2024
@B4nan
Copy link
Member

B4nan commented Jan 11, 2024

The builds errors should be fixed in master, cc @vladfrangu

We cant do much about old versions, as they are already published, but the issue you are referring to (with downgrades) is already fixed in the latest versions, as we pin the internal dependencies (see #2040) - it was fixed in v3.5.3 if I am not mistaken.

@B4nan
Copy link
Member

B4nan commented Jan 11, 2024

What version of TS are you using? IIRC you need 5.3 now.

@wojtekKrol
Copy link
Author

I'm using 5.2.2 But I don't understand why npm/yarn works this way, that it install newer packages that I want

@B4nan
Copy link
Member

B4nan commented Jan 11, 2024

Because you use crawlee metapackage, you get the right version of that, but it allows ^ of all the @crawlee/ packages. And that is what is already fixed since v3.5.3.

@B4nan
Copy link
Member

B4nan commented Jan 11, 2024

Try using latest version with TS 5.3, alternatively you can use skipLibCheck to suppress those TS errors.

@wojtekKrol
Copy link
Author

wojtekKrol commented Jan 11, 2024

Oh I get it, so it does not matter that in my project I'm using crawlee: 3.4.0 (without caret(^)) it uses the caret sign underneath anyway and bump all versions - I did not expect that

@B4nan
Copy link
Member

B4nan commented Jan 11, 2024

lol, its caret symbol, not carrot :P

yeah exactly, fyi you can get around that with older versions via npm overrides (or yarn resolutions), or by installing the @crawlee/ packages directly instead of using the crawlee metapackage.

@wojtekKrol
Copy link
Author

Yeah, I meant caret of course haha :D Thanks for quick help! :)
Bumping typescript to 5.3.3 fixed my issue locally and on Jenkins pipeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

2 participants