Closed pilcrowonpaper closed 1 year ago
Same here on vercel using an endpoint like so:
import { google } from 'googleapis'
export async function get({ params }) {
const oauth2Client = new google.auth.OAuth2(
......
);
const scopes = [
'https://www.googleapis.com/auth/calendar.events.freebusy',
'https://www.googleapis.com/auth/calendar.events.owned',
'https://www.googleapis.com/auth/userinfo.email'
];
const authorizationUrl = oauth2Client.generateAuthUrl({
access_type: 'offline',
scope: scopes,
include_granted_scopes: true
});
return new Response(JSON.stringify({login: authorizationUrl}), {
status: 200,
headers: {
"Content-Type": "application/json",
"Access-Control-Allow-Origin" : "*"
}
});
}
The error is the same:
ERROR Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"TypeError [ERR_INVALID_ARG_TYPE]: The \"chunk\" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of ArrayBuffer"
@pilcrowOnPaper have you tried in the newest version? If so I can take a look. Also what version of Node are you using on Vercel?
For me it's ^1.6.10, node 18 - I'm not sure it's astro it's probably the vercel adaptor which for me is ^2.3.2 .
@matthewp
No issue with astro@1.6.15
and @astrojs/vercel@2.3.6
, both on Node v 16.x and 18.x.
Hey, really? I shall test it now!
@pilcrowOnPaper thanks for testing it.
@marcfielding1 please report back what you find!
@matthewp You tested this with an async handler? My initial results show the same problem, lemmy double check when I get home.(2 hours)
@marcfielding1 what did you find?
Closing as this issue is stale. Please file a new issue if you still see the same problem.
What version of
astro
are you using?1.6.11
Are you using an SSR adapter? If so, which one?
Vercel
What package manager are you using?
npm
What operating system are you using?
Mac
Describe the Bug
API routes returning
Response
or{ body }
with any value (string,null
,undefined
) will throw:Interestingly, this doesn't happen on edge functions.
Link to Minimal Reproducible Example
(error with any api route)
Participation