Skip to content

Regression with Analytics Engine writeDataPoint and older compatibility_date in 4.13.0 #9254

@Cherry

Description

@Cherry

Which Cloudflare product(s) does this pertain to?

Wrangler

What versions & operating system are you using?

wrangler 4.13.0

Please provide a link to a minimal reproduction

No response

Describe the Bug

With wrangler versions >= 4.13.0, if you have an older compatibility_date and are using Analytics Engine, writeDataPoint calls now throw errors locally.

In your wrangler config:

{
	"$schema": "node_modules/wrangler/config-schema.json",
	"name": "ae-repro",
	"main": "src/index.ts",
	"compatibility_date": "2023-10-31",
	"observability": {
		"enabled": true
	},
	"analytics_engine_datasets": [{
	  "binding": "ANALYTICS",
	  "dataset": "test"
	}]
}

src/index.ts:

export default {
	async fetch(request, env, ctx): Promise<Response> {
		env.ANALYTICS.writeDataPoint({
			blobs: [
				"foo"
			]
		})
		return new Response('Hello World!');
	},
} satisfies ExportedHandler<Env>;
  • npx wrangler@4.12.0 dev, hit worker, no errors
  • npx wrangler@4.13.0 dev hit worker, observe TypeError: env.ANALYTICS.writeDataPoint is not a function errors

Please provide any relevant error logs

✘ [ERROR] WARNING: Tried to access method or property 'writeDataPoint' on a Service Binding or Durable Object stub. Are you trying to use RPC? If so, please enable the 'rpc' compat flag or update your compat date to 2024-04-03 or later (see https://developers.cloudflare.com/workers/configuration/compatibility-dates/ ). If you are not trying to use RPC, please note that in the future, this property (and all other property names) will appear to be present as an RPC method.


[wrangler:err] TypeError: env.ANALYTICS.writeDataPoint is not a function

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that isn't working

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions