apolodoro
apolodoro
Explore posts from servers
CDCloudflare Developers
Created by apolodoro on 11/12/2024 in #workers-help
Unknown error 10013
Error on remote worker: APIError: A request to the Cloudflare API (/accounts/3ee55606f881222ad1efb703537713b1/workers/scripts/backoffice/edge-preview) failed.

at throwFetchError
(/node_modules/wrangler/wrangler-dist/cli.js:122866:18)
at fetchResult
(/node_modules/wrangler/wrangler-dist/cli.js:122779:5)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async createPreviewToken
(/node_modules/wrangler/wrangler-dist/cli.js:175341:29)
at async createWorkerPreview
(/node_modules/wrangler/wrangler-dist/cli.js:175362:17)
at async #previewToken
(/node_modules/wrangler/wrangler-dist/cli.js:175631:34)
at async #onBundleComplete
(/node_modules/wrangler/wrangler-dist/cli.js:175684:21)
at async Mutex.runWith
(/node_modules/wrangler/node_modules/miniflare/dist/src/index.js:3632:16)
{
text: 'A request to the Cloudflare API
(/accounts/3ee55606f881222ad1efb703537713b1/workers/scripts/backoffice/edge-preview) failed.',
notes: [ { text: 'workers.api.error.unknown [code: 10013]' } ],
location: undefined,
kind: 'error',
code: 10013,
accountTag: '3ee55606f881222ad1efb703537713b1'
}
Error on remote worker: APIError: A request to the Cloudflare API (/accounts/3ee55606f881222ad1efb703537713b1/workers/scripts/backoffice/edge-preview) failed.

at throwFetchError
(/node_modules/wrangler/wrangler-dist/cli.js:122866:18)
at fetchResult
(/node_modules/wrangler/wrangler-dist/cli.js:122779:5)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async createPreviewToken
(/node_modules/wrangler/wrangler-dist/cli.js:175341:29)
at async createWorkerPreview
(/node_modules/wrangler/wrangler-dist/cli.js:175362:17)
at async #previewToken
(/node_modules/wrangler/wrangler-dist/cli.js:175631:34)
at async #onBundleComplete
(/node_modules/wrangler/wrangler-dist/cli.js:175684:21)
at async Mutex.runWith
(/node_modules/wrangler/node_modules/miniflare/dist/src/index.js:3632:16)
{
text: 'A request to the Cloudflare API
(/accounts/3ee55606f881222ad1efb703537713b1/workers/scripts/backoffice/edge-preview) failed.',
notes: [ { text: 'workers.api.error.unknown [code: 10013]' } ],
location: undefined,
kind: 'error',
code: 10013,
accountTag: '3ee55606f881222ad1efb703537713b1'
}
I am getting this error using wrangler 3.86.1 and authentificated with wrangler login It happens when using wrangler dev --remote on a sveltekit deployed in workers with a D1 database binding Any idea what this could mean.
13 replies
HHono
Created by apolodoro on 7/15/2024 in #help
zValidator Middleware Error
I have literally only implemented the example
import { zValidator } from "@hono/zod-validator";
import { Hono } from "hono";
import { z } from "zod";

const app = new Hono();

const route = app.post(
"/posts",
zValidator(
"form",
z.object({
body: z.string(),
})
),
(c) => {
const validated = c.req.valid("form");
// ... use your validated data
}
);
import { zValidator } from "@hono/zod-validator";
import { Hono } from "hono";
import { z } from "zod";

const app = new Hono();

const route = app.post(
"/posts",
zValidator(
"form",
z.object({
body: z.string(),
})
),
(c) => {
const validated = c.req.valid("form");
// ... use your validated data
}
);
And is giving me this typescript error
Argument of type 'MiddlewareHandler<Env, string, { in: { form: { body: string | File; }; }; out: { form: { body: string; }; }; }>' is not assignable to parameter of type 'H<BlankEnv, "/posts", BlankInput, HandlerResponse<any>>'.
Argument of type 'MiddlewareHandler<Env, string, { in: { form: { body: string | File; }; }; out: { form: { body: string; }; }; }>' is not assignable to parameter of type 'H<BlankEnv, "/posts", BlankInput, HandlerResponse<any>>'.
1 replies
CDCloudflare Developers
Created by apolodoro on 3/14/2024 in #workers-help
TLS Issue - Workers to AWS IoT Core
I am trying to communicate to the AWS IoT core HTTPS endpoint through a cloudflare worker (using hono). I created a certificate and I tested successfully sending a message with curl and the downloaded certificates - https://docs.aws.amazon.com/iot/latest/developerguide/http.html
curl --tlsv1.2 \
--cacert Amazon-root-CA-1.pem \
--cert device.pem.crt \
--key private.pem.key \
--request POST \
--data "{ \"message\": \"Hello, world\" }" \
"https://IoT_data_endpoint:8443/topics/topic?qos=1"
curl --tlsv1.2 \
--cacert Amazon-root-CA-1.pem \
--cert device.pem.crt \
--key private.pem.key \
--request POST \
--data "{ \"message\": \"Hello, world\" }" \
"https://IoT_data_endpoint:8443/topics/topic?qos=1"
Then I configured the binding with wrangler
pnpx wrangler mtls-certificate upload --cert device.pem.crt --key private.pem.key --name AWS_IOT
pnpx wrangler mtls-certificate upload --cert device.pem.crt --key private.pem.key --name AWS_IOT
And then I configured an endpoint in hono
iotPublish.post("/", async (c) => {
try {
let topic = "test";
let message = { message: "hello" };

return await c.env.AWS_IOT.fetch(
`https://xxxxxx.iot.eu-central-1.amazonaws.com:8443/topics/topic?qos=1`,
{
method: "POST",

body: JSON.stringify(message),
}
);
} catch (e) {
console.log(e);
return Response.json({ error: JSON.stringify(e) }, { status: 500 });
}
});
iotPublish.post("/", async (c) => {
try {
let topic = "test";
let message = { message: "hello" };

return await c.env.AWS_IOT.fetch(
`https://xxxxxx.iot.eu-central-1.amazonaws.com:8443/topics/topic?qos=1`,
{
method: "POST",

body: JSON.stringify(message),
}
);
} catch (e) {
console.log(e);
return Response.json({ error: JSON.stringify(e) }, { status: 500 });
}
});
The result is always
{
"message": "Missing authentication",
"traceId": "8c6b18f4-b3d5-42c7-8edb-e2b0bbc09ad3"
}
{
"message": "Missing authentication",
"traceId": "8c6b18f4-b3d5-42c7-8edb-e2b0bbc09ad3"
}
Please help
1 replies
CDCloudflare Developers
Created by apolodoro on 3/13/2024 in #general-help
TLS issue - WORKER to AWS IoT Core
EDIT: THIS WORKS NOW! Just follow the steps bellow... EDIT: Make sure the compatibility_date = "2024-09-30" in your wrangler.toml is at least september 2024. I am trying to communicate to the AWS IoT core HTTPS endpoint through a cloudflare worker (using hono). I created a certificate and I tested successfully sending a message with curl and the downloaded certificates - https://docs.aws.amazon.com/iot/latest/developerguide/http.html
curl --tlsv1.2 \
--cacert Amazon-root-CA-1.pem \
--cert device.pem.crt \
--key private.pem.key \
--request POST \
--data "{ \"message\": \"Hello, world\" }" \
"https://IoT_data_endpoint:8443/topics/topic?qos=1"
curl --tlsv1.2 \
--cacert Amazon-root-CA-1.pem \
--cert device.pem.crt \
--key private.pem.key \
--request POST \
--data "{ \"message\": \"Hello, world\" }" \
"https://IoT_data_endpoint:8443/topics/topic?qos=1"
Then I configured the binding with wrangler
pnpx wrangler mtls-certificate upload --cert device.pem.crt --key private.pem.key --name AWS_IOT
pnpx wrangler mtls-certificate upload --cert device.pem.crt --key private.pem.key --name AWS_IOT
And then I configured an endpoint in hono
iotPublish.post("/", async (c) => {
try {
let topic = "test";
let message = { message: "hello" };

return await c.env.AWS_IOT.fetch(
`https://xxxxxx.iot.eu-central-1.amazonaws.com:8443/topics/topic?qos=1`,
{
method: "POST",

body: JSON.stringify(message),
}
);
} catch (e) {
console.log(e);
return Response.json({ error: JSON.stringify(e) }, { status: 500 });
}
});
iotPublish.post("/", async (c) => {
try {
let topic = "test";
let message = { message: "hello" };

return await c.env.AWS_IOT.fetch(
`https://xxxxxx.iot.eu-central-1.amazonaws.com:8443/topics/topic?qos=1`,
{
method: "POST",

body: JSON.stringify(message),
}
);
} catch (e) {
console.log(e);
return Response.json({ error: JSON.stringify(e) }, { status: 500 });
}
});
The result is always
{
"message": "Missing authentication",
"traceId": "8c6b18f4-b3d5-42c7-8edb-e2b0bbc09ad3"
}
{
"message": "Missing authentication",
"traceId": "8c6b18f4-b3d5-42c7-8edb-e2b0bbc09ad3"
}
Edit: you should get
{"message":"OK","traceId":"f6353148-67b1-707f-c50c-40e723b4c0d4"}
{"message":"OK","traceId":"f6353148-67b1-707f-c50c-40e723b4c0d4"}
Enjoy
21 replies
RRailway
Created by apolodoro on 3/1/2024 in #✋|help
Guacamole allowed?
So we are an irrigation engineering company. We have PLCs in our clients properties and we use guacamole + openvpn to securely allow them to connect to their machines via VNC in a seemless way. We are transitioning a lot of our infrastructure to railway and would like to move both the VPN server as well as the Guacamole service to railway to. However I have seen that both VNC and VPNs are not allowed. Would this be the case for this specific use case?
7 replies