-
Notifications
You must be signed in to change notification settings - Fork 3.9k
How to get gen2 function working? #1038
-
I've followed the docs, but I get a 500 error when I call the function.
Screenshot 2023年02月06日 at 23 10 18
Below is my code from the client.
try { const response = await httpsCallableFromURL<unknown, IToken>( functions, "https://getstreamtokenv2-nnvm3z4kea-ez.a.run.app/getstreamtokenv2" )(); return response.data; } catch (error) { throw new Error("token error"); }
Beta Was this translation helpful? Give feedback.
All reactions
Your 500 error indicates a server-side issue. The client code is simply the caller and can't fix a 500 error coming from the server. Make sure the function at https://getstreamtokenv2-nnvm3z4kea-ez.a.run.app/getstreamtokenv2 is working as expected.
Debugging Steps:
-
Check Server Logs: Look at the server-side logs to identify the cause of the 500 error.
-
Local Testing: If possible, test the function locally before deploying.
-
Dependencies: Ensure all dependencies are correctly installed on the server.
-
Request and Response: Ensure that the request and response formats are correct according to your function's expectations.
Here's an example of how you might log errors in your cloud fu...
Replies: 1 comment
-
Your 500 error indicates a server-side issue. The client code is simply the caller and can't fix a 500 error coming from the server. Make sure the function at https://getstreamtokenv2-nnvm3z4kea-ez.a.run.app/getstreamtokenv2 is working as expected.
Debugging Steps:
-
Check Server Logs: Look at the server-side logs to identify the cause of the 500 error.
-
Local Testing: If possible, test the function locally before deploying.
-
Dependencies: Ensure all dependencies are correctly installed on the server.
-
Request and Response: Ensure that the request and response formats are correct according to your function's expectations.
Here's an example of how you might log errors in your cloud function:
exports.yourFunction = functions.https.onCall((data, context) => { try { // Your code here } catch (error) { console.error(error); throw new functions.https.HttpsError('internal', 'An internal error occurred'); } });
This should give you a clearer picture of what might be going wrong on the server-side.
Beta Was this translation helpful? Give feedback.