v3.0.0 Beta #135
Replies: 21 comments 21 replies
-
Would love it if this was tree-shakeable! (ie, if you only want to talk to the workers API, then you should be able to bundle your JS app with only the files needed to do that) |
Beta Was this translation helpful? Give feedback.
-
I'm observing some minor type issues with the custom-hostname resource:
thanks! |
Beta Was this translation helpful? Give feedback.
-
It appears that listing queues is not paginatable? What's up with that? |
Beta Was this translation helpful? Give feedback.
-
I can’t find a method for editing stream videos, is it missing? |
Beta Was this translation helpful? Give feedback.
-
Attempting to pass in the native global new Cloudflare({
apiToken: process.env.["SOMETHING"],
fetch,
});
|
Beta Was this translation helpful? Give feedback.
-
Hi ! Method having a confusing signatureThe method asks for a body, i would have expected that it is the object containing the vecotrs to upsert, but the object is actually un-used : The special case of
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Hi there, I’m currently trying to migrate our Cloudflare integration to this package. However, right now, our blocker is the custom hostname API response type. It’s severely lacking in v3.0.0, but I see the issue being fixed in v3.1.0. I am specifically referring to the Hostname status as highlighted in the Custom Hostname docs
Here’s the API Reference: The release seemed imminent at the time, so I put a lid on it, but seeing that there has been no maintainer activity on the new release and after receiving no response on my previous inquiries, I thought I'd raise the issue here for clarification before moving forward with a custom patch. Is there an ETA for v3.1.0? |
Beta Was this translation helpful? Give feedback.
-
Hey, I see that the Analytics engine endpoints are missing |
Beta Was this translation helpful? Give feedback.
-
Direct Uploads do not correctly parse the params into a multipart form body. NodeJS: v21.7.3
|
Beta Was this translation helpful? Give feedback.
-
TUS Upload returns no information. Looks like its because there is no response body and the data is sent in the headers. Node v20.13.1
|
Beta Was this translation helpful? Give feedback.
-
@jacobbednarz What happened to WorkerRoutes from 3.0.0 to 3.1.0/3.2.0? Are they renamed or has the functionality moved outside of workers ? |
Beta Was this translation helpful? Give feedback.
-
I can't send v3.2.0 According to the documentation, it is necessary to send Content-Type: application/x-ndjson, but there does not appear to be a mechanism for sending ndjson in this client. https://developers.cloudflare.com/api/operations/vectorize-insert-vector This code does not work. import Cloudflare from "cloudflare";
const cf = new Cloudflare({ apiToken: 'my-token'});
const vectors: VectorizeVector[] = [{
id: '1',
values: [0, 0, 1]
}]
await cf.vectorize.indexes.insert("my-embeddings-index", {
account_id: 'my-id',
body: vectors.map((vector) => JSON.stringify(vector)).join('\n'),
});
// error: Uncaught (in promise) Error: 400 {"result":null,"success":false,"errors":[{"code":1005,"message":"vectorize.unknown_content_type"}],"messages":[]} Overriding headers or body with a third argument did not work. My work aroundFetching direct is here https://gist.github.com/mizchi/95fe46c39a2a6248eca3d3035567ef27#file-run-cfai-ts-L36-L51 |
Beta Was this translation helpful? Give feedback.
-
v3.2.0 Auth credentials are required for the IP list api in order to pass validation when that specific api doesn't require auth. const Cloudflare = require('cloudflare')
async function main() {
const cloudflare = new Cloudflare()
console.log(await cloudflare.ips.list())
}
main() produces the following error
Workaround const Cloudflare = require('cloudflare')
async function main() {
const cloudflare = new Cloudflare({
apiToken: 'dummy_value'
})
console.log(await cloudflare.ips.list())
}
main() works and prints out the IP ranges. When calling additional APIs that require a token, setting a real token on the client will naturally avoid this issue. For use cases where this is the only API being called however, using a real token leads to having an additional token to secure and manage which isn't ideal when the token is unnecessary. The equivalent functionality in the SDK for go https://pkg.go.dev/github.com/cloudflare/cloudflare-go#IPs doesn't require credentials and will work without any credential values being set package main
import (
"log"
"github.com/cloudflare/cloudflare-go"
)
func main() {
ranges, err := cloudflare.IPs()
if err != nil {
log.Fatalln(err)
}
log.Println(ranges)
} |
Beta Was this translation helpful? Give feedback.
-
Hi! Upgraded to v3. It seems the response signature for cache purging has changed. Using the previous (2.x) client, purging files was done via This returned a response as detailed here: https://developers.cloudflare.com/api/operations/zone-purge
For V3 purging works using: However the response is, on success:
And simply I was wondering if this is a permanent change? Or perhaps I need to do something else to get richer responses? It was useful to have proper error messages. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi! I'm using
The application bundled for v2 did not have this problem. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi there, This is a bug report. Steps to replicate: Invoke the dns records list API, filtering based on a comment: const paginatedResult = await this.cloudFlare.dns.records.list({
zone_id: zoneId,
comment: {
exact: 'some-comment-here',
},
}); The resulting query string is constructed as follows: '?comment%5Bexact%5D=some-comment-here'. Root cause This issue surrounds how qs.stringify is consumed within index.ts. The line causing this behaviour is here: cloudflare-typescript/src/index.ts Line 331 in bfebf03 Fix Amending this line to the following fixes the issue: return qs.stringify(query, { allowDots: true }); Allow dots will output the object structure used to construct queries using a dot notation. I suspect this behaviour is common to other parameters constructed in this manner, so is likely to fix many occurrences. |
Beta Was this translation helpful? Give feedback.
-
Hi @jacobbednarz, this is a bug report as well. I'm filing here because I am unable to file a new issue. I believe there was an incorrect rename of Could you please confirm if this rename was intentional? If not, can you revert this change or provide guidance on how to handle this in the latest release? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hey, I wonder why neither the API docs at https://developers.cloudflare.com nor this library include R2 object operations such as list, get, put, and delete. They do exist and are being used by wrangler. Example to list objects in a bucket:
|
Beta Was this translation helpful? Give feedback.
-
This is not so much a feedback for the typescript SDK but more for the OpenAPI in general, as this endpoint isn't documented: I assume it will therefore also not show up in the ts sdk or any other. I had to reverse engineer this from the dashboard. Couldn't find where to submit this issue. |
Beta Was this translation helpful? Give feedback.
-
SDK Type does not match Stream API ResponseHello everyone! I'm having an issue where the Cloudflare Stream API response type does not match the defined Typescript type in the SDK. This means I cannot rely on the SDK type and have to override it to consume the API response.
My Code:const cloudflare = new Cloudflare({
apiToken: CLOUDFLARE_API_TOKEN,
});
const liveInput = await cloudflare.stream.liveInputs.get(liveInputId, {
account_id: CLOUDFLARE_ACCOUNT_ID,
}); The SDK response type:The SDK expects /**
* Details about a live input.
*/
export interface LiveInput {
// ... other interface fields
/**
* The connection status of a live input.
*/
status?:
| 'connected'
| 'reconnected'
| 'reconnecting'
| 'client_disconnect'
| 'ttl_exceeded'
| 'failed_to_connect'
| 'failed_to_reconnect'
| 'new_configuration_accepted'
| null;
} The actual API Response:The API returns an object type for {
// ...Other response fields
status: {
current: {
ingestProtocol: 'rtmp',
reason: 'client_disconnect',
state: 'disconnected',
statusEnteredAt: '2024-10-11T23:25:41.470Z',
statusLastSeen: '2024-10-11T23:25:41.470Z'
},
history: [
{
ingestProtocol: 'rtmp',
reason: 'connected',
state: 'connected',
statusEnteredAt: '2024-10-11T23:24:40.901Z'
}
]
}
} As you can see, the API response does not match the SDK type. Is this something I can fix in my SDK configuration? Or are the SDK types just wrong? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Warning
v3.x
of this library is a ground-up rewrite of the SDK, using code generation from our OpenAPI spec.This package should be in a usable state for many projects, but expect frequent minor breaking
changes as we rename methods and types until GA. If this isn't suitable for you project, we recommend
pinning to the
2.x
releases for now.We're working on a new major version of our SDK and are excited to have you test it!
Please use this discussion page as a place to report issues and feedback about the new release.
Install
Things we would like feedback on
Beta Was this translation helpful? Give feedback.
All reactions