question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find name 'DedicatedGatewayRequestOptions'

See original GitHub issue
  • Package Name: @azure/cosmos
  • Package Version: 3.16.0
  • Operating system: Windows
  • [v] nodejs
    • version: 16.15.0
  • [v] typescript
    • version: 4.0.0
  • [v] Functions
    • version: 3.0.0

Describe the bug I am trying to use @azure/cosmos inside an Azure Function written in typescript. When I try to npm run build, the build fails with : node_modules/@azure/cosmos/dist/types/latest/cosmos.d.ts:1365:78 - error TS2304: Cannot find name 'DedicatedGatewayRequestOptions'. at the stage of tsc.

To Reproduce Steps to reproduce the behavior:

  1. Create an azure function in typescript
  2. NPM Install @azure/cosmos 3.16.0
  3. Try to run locally the function

Expected behavior Be able to run the function without tsc bug.

Additional context I try to run the function locally, using Visual Studio Code, but I guess it will happen on terminal or in remote too.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
xirzeccommented, May 27, 2022

@joheredi @xirzec for FYI. Not sure I agree with using betaTrimmedFilePath for a stable library. We should do that if we are going to release a 3.16.0-beta, but in this case the interface cannot be marked beta since it is a dependency of a stable interface (RequestOptions). The only logical case for a stable interface to depend on a beta interface is if the package is itself releasing a new minor beta. The reason we missed this is probably because we test with skipLibCheck disabled ourselves.

Yeah, I agree this one is a bit odd due to the fact a stable interface depends on it. I think this will be a good case study as we figure out the guidelines for beta APIs.

2reactions
witemple-msftcommented, May 26, 2022

@raskyer As a quick workaround until we can get a fix released, you can enable the skipLibCheck option in your tsconfig file. This option will cause the typescript compiler to skip checking dependencies’ .d.ts files for completeness. Your code will still be checked against the cosmos.d.ts types, but the cosmos.d.ts file itself will not be checked (effectively, it’ll be like the missing interface is declared empty).

image

Another option, if you want to keep lib checking enabled, is to declare the missing type in your project (such as in the index or entry-point file):

declare module "@azure/cosmos" {
  interface DedicatedGatewayRequestOptions {}
}

This will create an ambient definition for the interface in your project that will safely merge with the real definition once a fix is released (at which point you can just remove it).

@joheredi @xirzec for FYI. Not sure I agree with using betaTrimmedFilePath for a stable library. We should do that if we are going to release a 3.16.0-beta, but in this case the interface cannot be marked beta since it is a dependency of a stable interface (RequestOptions). The only logical case for a stable interface to depend on a beta interface is if the package is itself releasing a new minor beta. The reason we missed this is probably because we test with skipLibCheck disabled ourselves.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DedicatedGatewayRequestOptio...
Gets the staleness value associated with the request in the Azure CosmosDB service. DedicatedGatewayRequestOptions, setMaxIntegratedCacheStaleness(Duration ...
Read more >
cannot find name with typescript and deno
I have the error : error: TS2304 [ERROR]: Cannot find name 'mapboxgl'. mapboxgl.accessToken ...
Read more >
CosmosItemRequestOptions (Azure SDK for Java ... - NET
Gets the Dedicated Gateway Request Options. String. getIfMatchETag(). Gets the If-Match (ETag) associated with the request in the Azure Cosmos DB service.
Read more >
@azure/cosmos | Yarn - Package Manager
Important: This documentation covers modern versions of Yarn. For 1.x docs, see classic.yarnpkg.com. Yarn.
Read more >
Error TS2304 Cannot find name 'WebGLObject' - Questions
Hey there, I need help with my unity setup. I've got a new pc, so it's the second time that I installed babylon.js...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found