I can not fetch github api in worker

For Workes & Pages, what is the name of the domain?

https://weekly-rss.rivenqinyy.workers.dev/

What is the error number?

403

What is the error message?

response code 403

What is the issue or error you’re encountering

I simply request issues from a public warehouse, but a 403 error is returned every time. What should I do?

What steps have you taken to resolve the issue?

I switched several public warehouses, but still returned 403. Then I modified the request header and provided the token, but it didn’t work.
my code:
/**

  • Welcome to Cloudflare Workers! This is your first worker.
    • Run npm run dev in your terminal to start a development server
    • Run npm run deploy to publish your worker
  • Bind resources to your worker in wrangler.toml. After adding bindings, a type definition for the
  • Env object can be regenerated with npm run cf-typegen.
  • Learn more at Cloudflare Workers · Cloudflare Workers docs
    */

export interface Env {
GITHUB_TOKEN: string;
}

async function getIssues(token: string) {
const headers = {
‘Content-Type’: ‘application/json’,
// @ts-ignore
Authorization: bearer ${token},
accept: ‘application/vnd.github.v3+json’,
};

console.log('headers', headers);

const response = await fetch('https://api.github.com/repos/primefaces/primevue/issues', {
	headers,
});
if (response.ok) {
	const data = await response.json();
	return data;
} else {
	console.log('error fetching issues', response);
	throw new Error('Failed to fetch issues');
}

}

export default {
async fetch(request, env, ctx): Promise {
const issues = await getIssues(env.GITHUB_TOKEN);
// github api
return Response.json(issues);
},
} satisfies ExportedHandler;

I am sure I have env token.

I see that you mentioned a 403 error but could you check the exact message that’s written in the error. 403 error usually refers to a permissions issue so could you also check that the access token that you are using at the moment is not invalidated. You could also regenerate a new access token and use it:

https://github.com/settings/tokens

Thanks.
I am glad for someone repley me.
I ensure the token is valid, because I use it fetch data in local script.even I do not use headers to fetch github api data, everything is ok.But I can not fetch github api data in cloudflare worker.
:joy:

Same error here. I ran the exact same code with bun and have no problem. But with worker I get 403.