W
Wasp7d ago
wbjb

re-deploy updates

@kapa.ai what is the command to redploy after changes to fy
5 Replies
kapa.ai
kapa.ai7d ago
Hi @wbjb. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To redeploy your Wasp app with updates to Fly.io, you can use the following command:
wasp deploy fly deploy
wasp deploy fly deploy
This command is used to push your latest changes live, updating both the client and server of your deployed app on Fly.io. According to the Wasp CLI deployment documentation, you should run this command whenever you want to update your deployed app with the latest changes. Remember to run wasp build before deploying if you've made changes to your Wasp file or other source files, as this will rebuild your app with the latest changes. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @wbjb, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
wbjb
wbjbOP7d ago
@kapa.ai index-DjV399dL.js:89 TypeError: Cannot read properties of undefined (reading 'length') at onAccept (index-DjV399dL.js:89:22041) at hf (index-DjV399dL.js:89:4538) at sk (index-DjV399dL.js:89:21468) signup:1 Access to XMLHttpRequest at 'https://haystackgold-server.fly.dev/auth/email/signup' from origin 'https://haystackgold-client.fly.dev' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. haystackgold-server.…auth/email/signup:1 Failed to load resource: net::ERR_FAILED signup:1 Access to XMLHttpRequest at 'https://haystackgold-server.fly.dev/auth/me' from origin 'https://haystackgold-client.fly.dev' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. haystackgold-server.fly.dev/auth/me:1 Failed to load resource: net::ERR_FAILED
kapa.ai
kapa.ai7d ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- It appears you're encountering CORS (Cross-Origin Resource Sharing) issues with your Wasp application deployed on Fly.io. This is preventing your client-side application from making requests to your server. Let's address this problem: 1. CORS Configuration: The error messages indicate that the server is not properly configured to allow requests from your client's origin. In Wasp, you can configure CORS settings for your server. To fix this, you need to specify the client's URL in your server configuration. You can do this by setting an environment variable on your Fly.io deployment. Here's how: Accessing App Config suggests using an environment variable to configure CORS:
fly secrets set WASP_WEB_CLIENT_URL=<https://haystackgold-client.fly.dev>
fly secrets set WASP_WEB_CLIENT_URL=<https://haystackgold-client.fly.dev>
This sets the WASP_WEB_CLIENT_URL environment variable to your client's URL, which Wasp will use to configure CORS correctly. 2. API Namespace: If you're using custom API endpoints, you might need to configure CORS for those specifically. You can do this using the apiNamespace feature in Wasp. Custom HTTP API Endpoints provides an example:
apiNamespace fooBar {
middlewareConfigFn: import { fooBarNamespaceMiddlewareFn } from "@src/apis",
path: "/foo"
}
apiNamespace fooBar {
middlewareConfigFn: import { fooBarNamespaceMiddlewareFn } from "@src/apis",
path: "/foo"
}
Then in your implementation file:
export const apiMiddleware = (config) => {
return config;
};
export const apiMiddleware = (config) => {
return config;
};
This will apply the default CORS configuration to all APIs under the specified path. 3. Redeployment: After making these changes, you'll need to redeploy your application. Use the command:
wasp deploy fly deploy
wasp deploy fly deploy
This will update your deployment with the new CORS configuration. If you're still experiencing issues after these steps, you might need to review your server setup and ensure that all your API endpoints are properly configured to handle CORS. Also, double-check that your client-side code is making requests to the correct server URL. Remember, CORS is a security feature, so it's important to configure it correctly to allow only the necessary origins while maintaining security. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @wbjb, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
wbjb
wbjbOP6d ago
@kapa.ai how do i verify that the client is going to the correct server
kapa.ai
kapa.ai6d ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- To verify that your client is connecting to the correct server in a Wasp application, you can follow these steps: 1. Check the client configuration: The client configuration object in Wasp contains the apiUrl field, which specifies the URL of your server. You can access this in your client-side code as follows:
import { config } from 'wasp/client'

console.log(config.apiUrl)

import { config } from 'wasp/client'

console.log(config.apiUrl)

This will log the server URL that your client is configured to use. Make sure this matches your expected server URL. Client configuration object 2. Verify the REACT_APP_API_URL environment variable: The apiUrl in the client configuration is set using the REACT_APP_API_URL environment variable. You should check if this variable is set correctly for your deployment. Environment Variables 3. Use browser developer tools: Open your browser's developer tools and go to the Network tab. Make API requests from your application and observe the URLs of the outgoing requests. They should match your server's URL. 4. Check for CORS errors: If you're seeing CORS errors in the console (like in your previous question), it could indicate that your client is trying to access the correct server, but the server is not configured to accept requests from your client's origin. 5. Verify server configuration: On the server side, make sure the WASP_WEB_CLIENT_URL environment variable is set correctly. This should match your client's URL:
fly secrets set WASP_WEB_CLIENT_URL=<https://your-client-url.fly.dev>

fly secrets set WASP_WEB_CLIENT_URL=<https://your-client-url.fly.dev>

Using a Custom Domain For Your App 6. Redeploy if necessary: If you've made changes to your configuration, remember to redeploy your application:
wasp deploy fly deploy

wasp deploy fly deploy

By following these steps, you should be able to verify and ensure that your client is connecting to the correct server. If you're still experiencing issues, it might be helpful to double-check your deployment configuration and ensure all environment variables are set correctly. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @wbjb, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?

Did you find this page helpful?